TreeItem
id, label, children=list(), disabled=False) TreeItem(
Represents a single item in a tree data structure. Passed to input_treeview()
.
Parameters
id :
str
-
Unique identifier for the tree item. Must be unique across all items in the tree.
label :
str
-
Display text for the tree item. Can include emoji and other characters.
children :
list
[TreeItem] = list()-
List of child nodes.
disabled :
bool
= False-
Whether the item is disabled (non-selectable).
Examples
Simple leaf item:
>>> from shiny_treeview import TreeItem
>>> leaf = TreeItem(id="doc1", label="📄 Document.pdf")
Parent item with children:
>>> folder = TreeItem(
id="documents",
... ="📁 Documents",
... label=[
... childrenid="doc1", label="📄 Report.pdf"),
... TreeItem(id="doc2", label="📄 Presentation.pptx", disabled=True)
... TreeItem(
... ] ... )