Shadcn Tree
View docsBrowse 7 production-ready shadcn tree components using @headless-tree/core and @headless-tree/react. Covers basic tree, indented guide lines, custom indentation, file explorer with type icons, organization chart with avatars, and permissions tree with checkboxes: all keyboard accessible with expand and collapse animations.
Basic tree.
Tree with indented lines.
Tree with custom indent.
Tree with custom indent.
File explorer tree with type icons
Organization chart tree with avatars
Permissions tree with checkboxes
Shadcn Tree: File Explorer and Hierarchical Navigation
ReUI Tree is a custom shadcn component built on @headless-tree/core and @headless-tree/react: a fully accessible, headless tree view library that handles expand/collapse state, keyboard navigation, selection model, async child loading, and WAI-ARIA tree roles without dictating markup.
Seven components cover a basic tree, indented guide lines, custom indent sizes, file explorer with file type icons, organization chart with avatar-based nodes, and a permissions tree with per-node checkbox selection.
The sections below explain the Headless Tree foundation, use cases across file systems, org charts, and permission editors, feature details, and composition guidance.
What is Shadcn Tree?
ReUI Tree is a custom shadcn component: not part of the base shadcn/ui library. It is built on @headless-tree/core for framework-agnostic tree state management and @headless-tree/react for React bindings. The library handles expand/collapse state, keyboard navigation (arrow keys, Home/End, typeahead character search), multi-selection, async child loading, drag-and-drop reordering, and WAI-ARIA tree and treeitem roles.
ReUI wraps the Headless Tree API in shadcn-compatible markup, using Tailwind for indentation guides, expand icons, hover and selection states. Components show trees inside realistic containers: a file explorer with file type icons and folder collapse, an organization chart with Avatar nodes, and a permissions editor with Checkbox nodes.
Why Use Shadcn Tree?
Hierarchical data appears in file systems, folder browsers, org charts, permission editors, navigation menus, category taxonomies, and code editors. Implementing a keyboard-accessible, WAI-ARIA-compliant tree from scratch is error-prone: Headless Tree handles all state and ARIA management. ReUI components give you production-ready markup and Tailwind styling you can adapt.
The file explorer component is directly applicable to document management, CMS folder browsers, and code editors. The permissions tree with checkboxes handles role-based access control UIs where permissions nest by resource and action. Pair with Shadcn Avatar for org charts and Shadcn Checkbox for permission nodes.
Libraries and ReUI Tree Primitives
ReUI Tree imports @headless-tree/core for the framework-agnostic tree state engine and @headless-tree/react for the React integration layer. It composes shadcn Avatar for org chart nodes and Checkbox for permission tree nodes.
The library supports sync and async child loading, virtual scroll integration, and drag-and-drop: features ReUI exposes as needed across the seven tree components.
Shadcn Tree Features
- Headless Tree Core and React. Powered by @headless-tree/core and @headless-tree/react. Full WAI-ARIA tree and treeitem roles, expand/collapse state, keyboard navigation (ArrowUp, ArrowDown, ArrowLeft to collapse, ArrowRight to expand, Home, End, typeahead), and multi-selection.
- File Explorer with Type Icons. File explorer component shows folder and file nodes with type-specific icons: distinguishing TypeScript, JSON, image, and folder nodes. Folders collapse and expand; files are leaf nodes with click actions.
- Organization Chart with Avatars. Org chart component renders each node with shadcn Avatar, name, and role. The tree structure represents reporting relationships and is collapsible at each manager level.
- Permissions Tree with Checkboxes. Permissions component adds shadcn Checkbox to each tree node for role-based access control UIs. Parent checkboxes reflect indeterminate state when only some children are checked.
- Indented Guide Lines. Optional vertical indentation guide lines clarify nesting depth for deep trees. Line style, color, and indent width are Tailwind utilities: customize per tree instance.
- Keyboard Navigation. Arrow keys navigate and expand/collapse nodes. Home and End jump to first and last visible node. Typeahead search jumps to nodes starting with the typed character. All navigation follows WAI-ARIA tree keyboard interaction models.
- Custom Indent and Node Rendering. Indent width is configurable per tree and per level. Each node renders any React content: icon, avatar, badge, action button: without breaking keyboard focus management.
ReUI Tree: In-House Custom Shadcn Component
ReUI Tree is an in-house component built and maintained by the ReUI team as part of the ReUI open-source library. It is designed to integrate seamlessly into any shadcn/ui project: following the same copy-and-own installation model. The component source lands directly in your repository; you own it, extend it, and style it with your Tailwind CSS tokens. ReUI Tree is a custom hierarchical navigation component not available in base shadcn/ui. Built on @headless-tree/core for framework-agnostic state management and @base-ui/react for React bindings, it handles expand/collapse, keyboard navigation (full WAI-ARIA tree semantics), multi-selection, and async child loading. Seven components cover basic tree, indented guide lines, file explorer with type icons, org chart with Avatar nodes, and a permissions tree with Checkbox selection.
The component is available in two API flavors to match your primitive stack: a Radix UI version for teams using Radix-based shadcn primitives, and a Base UI version for teams on @base-ui/react. Both versions share identical visual output and Tailwind CSS styling: only the underlying headless primitive differs. ReUI maintains 10+ such in-house components, all available in both Radix and Base UI versions, each with dedicated documentation covering the full component API, usage examples, and prop references.
Integrating With Other Components
Use Shadcn Avatar for org chart tree nodes, Shadcn Checkbox for permissions tree nodes, and Shadcn Badge for status or count indicators on folder nodes.
Pair Tree with Shadcn Scroll Area for constrained-height containers that scroll the tree list without growing the layout, and Shadcn Skeleton for async child loading states.
Combine with Shadcn Button for node actions (add child, rename, delete) and Shadcn Context Menu for right-click node action menus: a common component in file explorers and CMS folder trees.