Components · Data Display
Org Chart
People top-down as cards joined by lines, keyboard navigable as a tree. A TreeView on narrow screens.
import { OrgChart } from '@nexub/react';Usage
Reporting lines: a company, a team, a studio.
Any small hierarchy people scan by face or name.
Deep or wide data people search or check: use TreeView.
Free-form graphs and workflows: use DiagramCanvas.
Examples
Default
Custom cards, controlled
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| nodesrequired | OrgChartNode[] | — | The TreeView node shape plus description (the role line) and avatar (photo URL; initials without one). |
| aria-label | string | — | Names the tree. |
| aria-labelledby | string | — | Names the tree. |
| expanded | string[] | — | Open node ids. Shared with the narrow-screen TreeView. |
| defaultExpanded | string[] | — | Open node ids. Shared with the narrow-screen TreeView. |
| onExpandedChange | ((ids: string[]) => void) | — | Open node ids. Shared with the narrow-screen TreeView. |
| onActivate | ((node: OrgChartNode) => void) | — | Click or Enter on a card, e.g. to open the profile. |
| renderCard | ((node: OrgChartNode) => React.ReactNode) | — | Replaces the card content; it also names the item. The reports control stays. |
| className | string | — | On the scroll box. Wide charts scroll sideways inside it. |
Accessibility
ARIA roles
Keyboard
- ArrowDown / ArrowUp
Next or previous visible card in tree order (depth first), as in TreeView, not by position on screen.
- ArrowRight
Opens a closed card, or moves to its first report. Mirrored in RTL.
- ArrowLeft
Closes an open card, or moves to its manager. Mirrored in RTL.
- Home / End
First or last visible card.
- Enter
Calls `onActivate`.
- Space
Opens or closes the card’s reports.
Focus
The chart is one tab stop (roving tabindex); focus scrolls the card into view.
Notes
Each item is named by its name and role only, not by its reports.
The "3 reports" control is a pointer shortcut; keyboard and screen readers use the item’s expanded state.
Below 768px the same nodes render as a TreeView (photo, name and role on one row).
Connectors are CSS borders on logical sides, so RTL mirrors and forced colours keep them.