File tree
A keyboard-navigable tree for folders and files.
README.md · 2.1 KB · edited yesterday by Ivo Petrov
When to use
- File and project browsers.
- Any hierarchy where depth matters.
When not to use
- The list is flat; use a list.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/file-tree
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
FileTree
5 props
PropTypeDefault
labelstring"Files"
nodes *readonly FileTreeNode[]—
valuestring—
onValueChange((value: string) => void)—
classNamestring—
Keyboard
- →
- Moves to the next item or value.
- ←
- Moves to the previous item or value.
Accessibility
It exposes treeitem, group, none and tree semantics, with aria-level, aria-expanded, aria-selected, aria-hidden and aria-label kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/file-tree.mdThe index of every part is at /llms.txt.