Renders a Shiny output element (input element by class, e.g. plotly-output,
or by tag name, e.g. shiny-data-frame) inside a React tree, and registers
it with Shiny so server-driven updates flow through.
No wrapper element: the ref goes straight onto the rendered element so
direct-child CSS (flex gap, > * selectors, grid layouts) works as the
caller expects. See https://github.com/posit-dev/shinyreact/issues/61.
Binding-scope notes (the asymmetry between bindAll and unbindAll is
intentional — Shiny's API is asymmetric):
• Shiny.bindAll(scope) is descendants-only — output bindings call
$(scope).find(selector), which excludes scope itself. So we pass
the parent element as scope, guaranteeing our element is found.
Once a call has settled this is safe to repeat: Shiny skips elements
already marked .shiny-bound-output / .shiny-bound-input, so
re-binding the parent does not re-bind sibling outputs. Calls that
would overlap are coalesced by dedupedBindAll above (#298).
• Shiny.unbindAll(scope) would unbind every Shiny output under
scope, which would clobber siblings. Instead we pass our own element
with includeSelf=true, so only this output is unbound.
Renders a Shiny output element (input element by class, e.g.
plotly-output, or by tag name, e.g.shiny-data-frame) inside a React tree, and registers it with Shiny so server-driven updates flow through.No wrapper element: the
refgoes straight onto the rendered element so direct-child CSS (flexgap,> *selectors, grid layouts) works as the caller expects. See https://github.com/posit-dev/shinyreact/issues/61.Binding-scope notes (the asymmetry between bindAll and unbindAll is intentional — Shiny's API is asymmetric):
•
Shiny.bindAll(scope)is descendants-only — output bindings call$(scope).find(selector), which excludesscopeitself. So we pass the parent element as scope, guaranteeing our element is found. Once a call has settled this is safe to repeat: Shiny skips elements already marked.shiny-bound-output/.shiny-bound-input, so re-binding the parent does not re-bind sibling outputs. Calls that would overlap are coalesced bydedupedBindAllabove (#298).•
Shiny.unbindAll(scope)would unbind every Shiny output underscope, which would clobber siblings. Instead we pass our own element withincludeSelf=true, so only this output is unbound.