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
- Kotlin
- Dart
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,
)
| Name | Type | Default |
|---|---|---|
roots | List<CamoTreeNode<T>> | required |
expanded | Set<Any> | required |
onExpandedChange | (Set<Any>) -> Unit | required |
selected | Set<Any> | required |
onSelectedChange | (Set<Any>) -> Unit | required |
label | (T) -> String | required |
caption | String | required |
modifier | Modifier | Modifier |
multiSelect | Boolean | false |
onLoadChildren | ((CamoTreeNode<T>) -> Unit)? | null |
icon | ((T, Boolean) -> (@Composable () -> Unit))? | null |
speedSearch | CamoSpeedSearchState? | null |
Design notes
Why CamoTree works this way, its states and its edge cases: contributor docs.