ValyroUI Русская версия

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

PropTypeDefault
nodesCheckboxTreeNode[]The tree. Or compose it as children: CheckboxTree.Item elements, nested for branches.
childrenReactNodeThe compound form instead of nodes: CheckboxTree.Item elements.
valuestring[]Ids of the checked leaves (controlled); parents show checked, mixed or unchecked from them.
defaultValuestring[]Initial value when uncontrolled.
onValueChange(value: string[]) => voidCalled with the new value when it changes.
expandedstring[]Ids of the expanded parents (controlled).
defaultExpandedstring[]Initial expanded when uncontrolled.
onExpandedChange(expanded: string[]) => voidCalled with the new expanded when it changes.
guidesbooleantrueConnector lines from each parent to its children. Default true.
size'sm' | 'md''md'Row height. Default md.

Compound parts

CheckboxTree.Item (CheckboxTreeItem)

Related components

Previous: Chip Group · Next: Checkbox · All Forms and input