Component

Tree

Navigates hierarchical items with expand/collapse, single or multiple selection, typeahead, and full keyboard support.

Install

Run the CLI to copy the source into your project.

pnpm dlx @stalk-ui/cli add @stalk-ui/tree

Examples

Live previews render through the docs app's PandaCSS codegen.

Theme
<FileTree />

Props

Public component props extracted from the source TypeScript types.

PropTypeRequiredDefaultDescription
`nodes``readonly TreeNode[]`Yes--
`expanded``readonly string[]`No-Expanded branch ids (controlled).
`defaultExpanded``readonly string[]`No--
`onExpandedChange``(expanded: string[]) => void`No--
`selectionMode``'single' \'multiple'`No-
`selected``readonly string[]`No-Selected node ids (controlled).
`defaultSelected``readonly string[]`No--
`onSelectedChange``(selected: string[]) => void`No--
`variant``'ghost' \'solid' \'outline'`No
`size``'micro' \'sm' \'md' \'lg'`
`radius``'none' \'sm' \'md' \'lg' \
`fullWidth``boolean`No-Rows span the tree's full width at every depth — equal boxes with aligned<br />edges — and the indent moves inside the row.
`guides``boolean`No-Draw indentation guide lines along nested groups.
`typeahead``boolean`No-Typing jumps focus to the next row starting with the typed characters. Defaults to \`true\`.
`'aria-label'``string`No-Accessible name for the tree.

Variants

Variant axes exposed by the underlying PandaCSS recipe or slot recipe.

VariantValues
`variant``ghost`, `solid`, `outline`
`size``micro`, `sm`, `md`, `lg`
`radius``none`, `sm`, `md`, `lg`, `full`
`guides``false`, `true`
`fullWidth``false`, `true`

Registry

Files this component contributes to your registry install.

  • Manifest: `/r/tree.json`
  • Recipe: `tree`
  • Files: `src/components/ui/tree.tsx`