useNested
Commons
stable
Manages a tree of selectable and openable items via provide/inject. Maintains a parent→child registry, applies a configurable open strategy (single / list / multiple) and a select strategy (classic / leaf / independent / single-leaf / single-independent). Used internally by OrigamTreeview, OrigamList, and OrigamExpansionPanels.
API
Signature
Full TypeScript signature sourced from the composable file.
Consumed interfaces
INestedProps
API
Parameters
Input parameters accepted by this composable.
- propsrequiredINestedProps
- Props including `opened` (initial open set), `selected` (initial selection map), `selectStrategy` (string or custom object), `openStrategy` (string or custom object), and `mandatory`.
API
Return values
Properties and methods exposed by the composable return object.
- opened
- Reactive set of currently open node IDs. Synced to v-model:opened via useVModel.
- selected
- Reactive selection map. Values are "on", "off", or "indeterminate" (for classic strategy parent nodes).
- selectedValues
- Flat array of IDs whose selection state is "on". Convenient for v-model:selected binding.
- register
- Registers a node in the parent/children maps. Called automatically by useNestedItem on mount.
- unregister
- Removes a node from all maps and closes it. Called automatically by useNestedItem on unmount.
- open
- Toggles the open state of a node according to the active open strategy. Emits click:open and update:opened.
- select
- Applies the active select strategy for the given node. Emits click:select and update:selected.
Usage
Examples
Ready-to-paste usage snippets.
Treeview with classic select strategy
Single-open expansion panel list