Checkbox Tree
Checkbox tree: cascading, indeterminate state, keyboard. Free, MIT · Forms and input › Selects
Installation
npx valyro-cli@latest add checkbox-tree
npx shadcn@latest add https://valyro.xyz/r/checkbox-tree.json
npm install valyro-ui
import 'valyro-ui/styles.css';
import { CheckboxTree } from 'valyro-ui';
Props
| Prop | Type | Default | |
|---|---|---|---|
nodes | CheckboxTreeNode[] | The tree. Or compose it as children: CheckboxTree.Item elements, nested for branches. | |
children | ReactNode | The compound form instead of nodes: CheckboxTree.Item elements. | |
value | string[] | Ids of the checked leaves (controlled); parents show checked, mixed or unchecked from them. | |
defaultValue | string[] | Initial value when uncontrolled. | |
onValueChange | (value: string[]) => void | Called with the new value when it changes. | |
expanded | string[] | Ids of the expanded parents (controlled). | |
defaultExpanded | string[] | Initial expanded when uncontrolled. | |
onExpandedChange | (expanded: string[]) => void | Called with the new expanded when it changes. | |
guides | boolean | true | Connector lines from each parent to its children. Default true. |
size | 'sm' | 'md' | 'md' | Row height. Default md. |
Compound parts
CheckboxTree.Item (CheckboxTreeItem)
Related components
- Select — Pick one option from a list
- Multi Select — Pick several options
- Combobox — Searchable select
- Listbox — Option list on the page: one or several, Shift ranges
- Chip Group — Chip group with icons: one or several options
- Text Input — Text fields
- Textarea — Multiline text input
- Search Input — Search field
- Mentions Input — Text with @mentions and #tags, async suggestions
- Tags Input — Tag entry
- Checkbox — Checkboxes
- Checkbox Group — Checkboxes under one label, hint, error and requirement
Previous: Chip Group · Next: Checkbox · All Forms and input