input_treeview

input_treeview(id, items, *, multiple=False, selected=None, expanded=None)

Create a treeview input component.

Parameters

id : str

The input id.

items : list[TreeItem]

A list of TreeItem objects representing the tree data.

multiple : bool = False

Whether to allow multiple selection.

selected : Optional[str | list[str]] = None

Initially selected item ID(s). If None (default), no items are selected.

expanded : Optional[str | list[str]] = None

Initially expanded item ID(s). If None (default), automatically expands all parents necessary to make visible the items in the selected argument.

Returns

: Tag

An element used when creating your Shiny app UI.

Notes

If multiple=False, the server value is a string with the ID of the selected item. If multiple=True, the server value is a tuple containing the IDs of the selected items. When nothing is selected, this value will be None.