Basic tree
app
layout.tsx
page.tsx
global.css
lib
package.json
tsconfig.json
Tree example
Nested folders
Create deeply nested structures by nestingTree.Folder components within each other.
app
layout.tsx
page.tsx
api
auth
route.ts
components
package.json
Nested folders example
Keyboard navigation
The tree component supports keyboard navigation.- Arrow keys: Navigate up and down through visible items.
- Right arrow: Expand a closed folder or move to the first child of an open folder.
- Left arrow: Collapse an open folder or move to the parent folder.
- Home: Jump to the first item in the tree.
- End: Jump to the last visible item in the tree.
- Enter/Space: Toggle folder open/closed state.
- *: Expand all sibling folders at the current level.
- Type-ahead search: Type characters to jump to items that start with those characters.
Properties
Tree.Folder
The name of the folder displayed in the tree.
Whether the folder is expanded by default.
Whether the folder can be opened and closed. Set to false for non-interactive folders.
Tree.File
The name of the file displayed in the tree.