Skip to main content

CamoTree

Hierarchical data you can expand and collapse. The app owns expanded and selected (sets of node keys). Click selects (with multiSelect, toggles); the chevron expands. A node whose children aren't loaded asks for them once through onLoadChildren when it expands. Up and Down move, Right expands or enters the first child, Left collapses or goes to the parent, Home and End jump, Enter or Space selects. caption names the tree.

API​

public fun <T> CamoTree(
roots: List<CamoTreeNode<T>>,
expanded: Set<Any>,
onExpandedChange: (Set<Any>) -> Unit,
selected: Set<Any>,
onSelectedChange: (Set<Any>) -> Unit,
label: (T) -> String,
caption: String,
modifier: Modifier = Modifier,
multiSelect: Boolean = false,
onLoadChildren: ((CamoTreeNode<T>) -> Unit)? = null,
icon: ((T, Boolean) -> (@Composable () -> Unit))? = null,
speedSearch: CamoSpeedSearchState? = null,
)
NameTypeDefault
rootsList<CamoTreeNode<T>>required
expandedSet<Any>required
onExpandedChange(Set<Any>) -> Unitrequired
selectedSet<Any>required
onSelectedChange(Set<Any>) -> Unitrequired
label(T) -> Stringrequired
captionStringrequired
modifierModifierModifier
multiSelectBooleanfalse
onLoadChildren((CamoTreeNode<T>) -> Unit)?null
icon((T, Boolean) -> (@Composable () -> Unit))?null
speedSearchCamoSpeedSearchState?null
Design notes

Why CamoTree works this way, its states and its edge cases: contributor docs.