host_input
host_input(output, id, widget, suffix='_ui')Register widget as a hosted output and return its output id.
Registers output[f"{id}{suffix}"] as an @render.ui output that calls widget() lazily – once per render, the same as any other Shiny output – and checks the result for an id collision (see :func:_check_no_id_collision) before returning it. The registration uses suspend_when_hidden=False: Shiny normally skips rendering an output it believes is hidden, based on the server-rendered DOM visibility of its container, but a hosted output’s container is a React element the client mounts on its own terms, which Shiny’s own visibility tracking cannot see. Without this, a hosted widget can simply never render on some page shapes.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| output | '_OutputsLike' | The output object from your server function. |
required |
| id | str | The base id. Your React element reads this output at f"{id}{suffix}" (the default suffix makes that "bins_ui" for id="bins"). |
required |
| widget | Callable[[], 'TagChild'] | A zero-argument callable returning the widget’s markup, e.g. lambda: ui.input_slider("bins", "Bins", 1, 50, 30). Called fresh on every render, exactly like the body of any @render.ui function. |
required |
| suffix | str | Appended to id to form the registered output name. |
'_ui' |
Returns
| Name | Type | Description |
|---|---|---|
| str | The output name (f"{id}{suffix}") the widget was registered |
|
| str | under – pass this straight to your React element’s id prop. |