input_treeview
input_treeview(
id,
items,
*,
selected=None,
expanded=None,
multiple=False,
checkbox=False,
width=None,
)Create a treeview component to navigate and select items from a hierarchical data structure.
Supports single or multiple selection. Nested levels can be expanded and collapsed.
Parameters
id :str-
The input id.
items :list[TreeItem]-
A list of TreeItem objects representing the tree data.
selected :str|list[str] = None-
Initially selected item ID(s). If None (default), no items are selected.
expanded :str|list[str] = None-
Initially expanded item ID(s). If None (default), ensures selected items are visible by expanding their parents.
multiple :bool= False-
Whether to allow multiple selection.
checkbox :bool= False-
Whether to show checkboxes for selection.
width :str= None-
The CSS width of the input component (e.g., “400px”, “100%”).
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 of the selected item IDs. When nothing is selected, the server value is None in both cases.