Components
Org chart
NativePeople and structures in a tree with automatic layout, right-angled connectors and collapsible branches.
The people behind the work
14 people · 3 teams. Expand a team to meet everyone.
Scroll to explore. Arrow keys move through the tree; Enter expands or collapses a branch.
Installation
npx nook-ui@latest add org-chartPrompt
Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.
Short. For assistants that can run commands in your project.
Add the Nook "Org chart" component to this project, exactly as Nook ships it.
People and structures in a tree with automatic layout, right-angled connectors and collapsible branches.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add org-chart`. It writes `components/ui/org-chart.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/org-chart.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
import { OrgChart, type OrgChartNode } from "@/components/ui/org-chart";
const company: OrgChartNode = { id: "maya", name: "Maya Chen", role: "Founder & CEO", children: [
{ id: "sam", name: "Sam Rivera", role: "Engineering", children: [
{ id: "ada", name: "Ada Morgan", role: "Frontend engineer" },
{ id: "leo", name: "Leo Park", role: "Backend engineer" },
{ id: "imani", name: "Imani Reed", role: "Platform engineer" },
{ id: "oliver", name: "Oliver Tan", role: "Quality engineer" },
] },
{ id: "noor", name: "Noor Hassan", role: "Design", children: [
{ id: "alex", name: "Alex Kim", role: "Product designer" },
{ id: "ruth", name: "Ruth Okafor", role: "Researcher" },
{ id: "jules", name: "Jules Martin", role: "Content designer" },
] },
{ id: "lena", name: "Lena Ortiz", role: "Operations", children: [
{ id: "ben", name: "Ben Wilson", role: "People partner" },
{ id: "asha", name: "Asha Patel", role: "Finance lead" },
{ id: "eli", name: "Eli Brooks", role: "Customer success" },
] },
] };
export default function OrgChartDefault() {
return <div className="grid w-full min-w-0 gap-3"><div><h3 className="font-semibold">The people behind the work</h3><p className="mt-1 text-xs text-muted-foreground">14 people · 3 teams. Expand a team to meet everyone.</p></div><OrgChart root={company} defaultCollapsed={["sam", "noor", "lena"]} aria-label="Studio company, 14 people" /></div>;
}
```
API
- `OrgChart`: Centers each manager above their subtree. Scroll to pan a large tree; collapsed branches report their full hidden descendant count. Node IDs must be unique and the tree must be acyclic.
- `root` (`OrgChartNode`): A node with id, name, optional role, initials and children.
- `collapsed, defaultCollapsed, onCollapsedChange` (`string[], string[], (ids: string[]) => void`): Controlled or initial IDs of collapsed branches.
- `renderNode` (`(node: OrgChartNode) => ReactNode`): Replace person content for site maps or product structures. Keep content concise and non-interactive; the tree item owns navigation.
- `onNodeSelect` (`(node: OrgChartNode) => void`): Called when a leaf is activated.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: A nested tree with one Tab stop and level, position, and expansion semantics. Up and Down follow visible tree order; Right expands or enters a branch, Left collapses or goes to the parent. Enter and Space toggle. Focus scrolls into view. Names and roles remain text.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { OrgChart, type OrgChartNode } from "@/components/ui/org-chart";
const company: OrgChartNode = { id: "maya", name: "Maya Chen", role: "Founder & CEO", children: [
{ id: "sam", name: "Sam Rivera", role: "Engineering", children: [
{ id: "ada", name: "Ada Morgan", role: "Frontend engineer" },
{ id: "leo", name: "Leo Park", role: "Backend engineer" },
{ id: "imani", name: "Imani Reed", role: "Platform engineer" },
{ id: "oliver", name: "Oliver Tan", role: "Quality engineer" },
] },
{ id: "noor", name: "Noor Hassan", role: "Design", children: [
{ id: "alex", name: "Alex Kim", role: "Product designer" },
{ id: "ruth", name: "Ruth Okafor", role: "Researcher" },
{ id: "jules", name: "Jules Martin", role: "Content designer" },
] },
{ id: "lena", name: "Lena Ortiz", role: "Operations", children: [
{ id: "ben", name: "Ben Wilson", role: "People partner" },
{ id: "asha", name: "Asha Patel", role: "Finance lead" },
{ id: "eli", name: "Eli Brooks", role: "Customer success" },
] },
] };
export default function OrgChartDefault() {
return <div className="grid w-full min-w-0 gap-3"><div><h3 className="font-semibold">The people behind the work</h3><p className="mt-1 text-xs text-muted-foreground">14 people · 3 teams. Expand a team to meet everyone.</p></div><OrgChart root={company} defaultCollapsed={["sam", "noor", "lena"]} aria-label="Studio company, 14 people" /></div>;
}Examples
A help center structure
Help center
Start here
Guides
3 articles
Reference
2 articles
Scroll to explore. Arrow keys move through the tree; Enter expands or collapses a branch.
Props
OrgChart
Centers each manager above their subtree. Scroll to pan a large tree; collapsed branches report their full hidden descendant count. Node IDs must be unique and the tree must be acyclic.
| Prop | Type | Default | Description |
|---|---|---|---|
| root | OrgChartNode | – | A node with id, name, optional role, initials and children. |
| collapsed, defaultCollapsed, onCollapsedChange | string[], string[], (ids: string[]) => void | – | Controlled or initial IDs of collapsed branches. |
| renderNode | (node: OrgChartNode) => ReactNode | – | Replace person content for site maps or product structures. Keep content concise and non-interactive; the tree item owns navigation. |
| onNodeSelect | (node: OrgChartNode) => void | – | Called when a leaf is activated. |
Accessibility
A nested tree with one Tab stop and level, position, and expansion semantics. Up and Down follow visible tree order; Right expands or enters a branch, Left collapses or goes to the parent. Enter and Space toggle. Focus scrolls into view. Names and roles remain text.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.