Data Display

Org Chart Tree

A collapsible org tree whose SVG connectors reflow along with the node animation.

This is a WebberUI Pro component

The install command below needs a licence to run; without one it returns 401.

How to install Pro components →See the plans →

Renders org tree data recursively: each node is a card with a gradient initials avatar, a name, and a job title, and clicking the button at the bottom of the card collapses or expands the subtree (folded with a height animation). Parents and children are strung together with connectors, and while collapsed the button shows the number of direct reports.

Bring this into your project

Run this command in your project folder. The CLI adds the source and dependencies; then follow the usage example below.

npx webberui@latest add "https://webberui.com/r/org-chart-tree.en.json?t=<install token>"

New project or installation trouble? Start here →

Playground

Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.

Active edited usageDefault props
<OrgChartTree/>

The complete example includes the preview layout and data. Install the component first, then paste this file into your project.

Installation

npx webberui@latest add "https://webberui.com/r/org-chart-tree.en.json?t=<install token>"

Or, once registries are configured in components.json, install it as @webberui/org-chart-tree.

Usage

import { OrgChartTree, type OrgNode } from "@/components/ui/org-chart-tree";

const tree: OrgNode = {
  id: "ceo",
  name: "Lin Hsiao-tung",
  title: "Chief Executive Officer",
  children: [
    { id: "cto", name: "Chen Chien-hung", title: "Chief Technology Officer" },
    { id: "cpo", name: "Huang Shih-han", title: "Chief Product Officer" },
  ],
};

<OrgChartTree data={tree} defaultCollapsed={["cto"]} />

Props

OrgChartTree

PropTypeDefaultDescription
dataOrgNode—The org tree data (a single root node, rendered recursively downward)
defaultCollapsedstring[][]List of node ids that start out collapsed
onToggle(id: string, collapsed: boolean) => void—Callback when a node expands or collapses
classNamestring—Forwarded to the outermost container

OrgNode

PropTypeDefaultDescription
idstring—Unique node identifier, used as the basis for the collapsed state and the key
namestring—Member name, used for display and for the avatar initials
titlestring—Job title, shown below the name
huenumberhashed from idHue of the avatar background (0–360)
childrenOrgNode[]—Direct child nodes; omit it and the node is a leaf

Accessibility

  • Collapse/expand is a native <button> that can be focused with Tab and triggered with Enter or Space, carrying a clear aria-label and an aria-expanded state
  • When the user has "reduce motion" enabled at the system level, collapsing, expanding, and the reveal animation switch straight over without playing a transition
  • The connectors and the avatar initials are decorative only, hidden from assistive technology with aria-hidden, so only the name and the job title are announced
  • The avatar hue is produced by a deterministic hash of id, so SSR and client rendering agree and no hydration mismatch occurs