Tree view
A React component in Beamline's Navigation category.
Nested folders and records with the full tree keyboard model (arrows, Home/End, *, type to jump), depth guides, counts and animated opening.
Use it for
- Nested hierarchies: files, folders, teams, categories.
Not for
Anatomy
- tree
- row: chevron, icon, label, badge
- depth guides
- group
States
- collapsed
- expanded
- focused
- selected
- disabled
Keyboard
- ↑ ↓ visible rows
- Inline-end arrow opens/enters (Right in LTR, Left in RTL)
- Inline-start arrow closes/returns to parent (Left in LTR, Right in RTL)
- Home / End
- * opens all siblings
- type to jump
- Enter / Space selects
Motion
Groups open and close by height over 200 ms; the chevron turns. The selected row's tint and rule are one plate that travels to the next row chosen (ui/lib/contour.ts); expanding or collapsing a branch places it without travel; a selected row inside a closed branch has no plate.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
nodes | { id, label, icon?, badge?, disabled?, children? }[] | — | |
expandedIds / defaultExpandedIds / onExpandedChange | string[] | — | |
selectedId / defaultSelectedId / onSelect | string / (node) => void | — | |
aria-label | string | — | |
classNames | typed part classes | — | See visualContract.slots; existing handlers, accessibility and internal measurement refs are preserved. |
style | CSSProperties | — | Visual root inline styles. |
ref | HTMLUListElement | — | Native visual root/control reference, composed with internal refs when present. |
Dependencies
lucide-react
Import
import { TreeView } from "@/components/tree-view/tree-view";
Get it
Tree view is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. Get Beamline · Connect your agent
More in Navigation
- Breadcrumb: Where a page sits and the way back up; long paths keep the first and last two levels and fold the middle into a menu.
- Menu bar: A desktop-style File / Edit / View bar for editor-like apps; each menu takes the same rows as the dropdown menu, and pointing moves between open menus.
- Navigation menu: A site or docs header whose sections open into one panel that resizes and slides between them; NavigationMenuCard is the standard link row.
- Pagination: Moves through pages of a known length: first, last and the current page's neighbours, with an optional “41–60 of 468”; a phone shows “Page 6 of 24”.
- Sidebar: The app's main navigation: sections, items with counts and one level of sub-pages, an icon rail with tooltips (⌘B, the trigger or the edge), and a sheet…
- Stepper: Where someone is in a multi-step flow: done steps carry a check, the current one a ring, and the line between marks fills as steps complete.
- Tabs: Switches between panels of one object; one indicator slides to the active tab, counts sit beside labels, and a long row scrolls instead of wrapping.
- User menu: The account menu behind the avatar: who is signed in, status, theme, account pages and sign out with progress; a bottom sheet on phones.