rememberTreeState

@Composable
fun rememberTreeState(initialSelectedPaths: Set<List<Int>> = emptySet(), initialExpandedPaths: Set<List<Int>> = emptySet()): TreeState

Creates and remembers a TreeState starting on initialSelectedPaths and initialExpandedPaths.

A later change to either neither recreates the state nor moves the tree; select and open afterwards through the returned state's TreeState.selectedPaths and TreeState.expandedPaths.

Parameters

initialSelectedPaths

the nodes selected until the caller or the user moves the selection.

initialExpandedPaths

the nodes open until the caller or the user opens or closes one.