# Org chart

Explore reporting relationships through an accessible team tree and connected person cards.

Access: pro. Category: Blocks. Kind: composite.

## When to use

- Use it when a page needs explore reporting relationships through an accessible team tree and connected person cards.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose analytics-card instead when explore revenue, compare periods and inspect chart values is the actual interface need, rather than org chart.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Org chart

```sh
npx shadcn@latest add @tidal-pro/org-chart
```

Stylesheets: `components/ui/tidal.css`, `components/ui/org-chart.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/org-chart.css";
import{TidalOrgChart}from"./components/ui/org-chart";
export default()=><div className="tidal-scope"><TidalOrgChart expandedIds={["example"]} onExpandedChange={() => {}} onSelectedChange={() => {}} people={[{id:"example",name:"Demo",role:"value",managerId:"example"}]} selectedId={"example"} title={"Demo"}/></div>;
```

## Structured props

- `TidalOrgChart.expandedIds: ReadonlyArray<string>`: Required expanded ids value accepted by this exported component.
- `TidalOrgChart.onExpandedChange: (ids: readonly string[], person: TidalOrgPerson, event: OrgEvent) => void`: Callback invoked when the expanded change interaction is proposed.
- `TidalOrgChart.onSelectedChange: (id: string, person: TidalOrgPerson, event: OrgEvent) => void`: Callback invoked when the selected change interaction is proposed.
- `TidalOrgChart.people: ReadonlyArray<TidalOrgPerson>`: Required people value accepted by this exported component.
- `TidalOrgChart.selectedId: string | null`: Required selected id value accepted by this exported component.
- `TidalOrgChart.title: ReactNode`: Required title value accepted by this exported component.
- `TidalOrgChart.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalOrgChart.detailAction?: ReactNode`: Optional detail action value accepted by this exported component.
- `TidalOrgChart.dir?: "ltr" | "rtl" | undefined` (default "ltr"): Optional dir value accepted by this exported component.
- `TidalOrgChart.disabled?: boolean | undefined` (default false): Optional disabled value accepted by this exported component.
- `TidalOrgChart.headingLevel?: "h2" | "h3" | "h4" | "h5" | undefined` (default "h2"): Optional heading level value accepted by this exported component.
- `TidalOrgChart.labels?: Partial<{ tree: string; reportsTo: string; reports: string; noReports: string; noManager: string; empty: string; choose: string; invalid: string; profile: string; }> | undefined`: Optional labels value accepted by this exported component.
- `TidalOrgChart.personItemProps?: ((person: TidalOrgPerson) => TidalTreeNode["itemProps"]) | undefined`: Optional person item props value accepted by this exported component.
- `TidalOrgChart.personItemRef?: ((person: TidalOrgPerson) => Ref<HTMLDivElement> | undefined) | undefined`: Optional person item ref value accepted by this exported component.
- `TidalOrgChart.treeRef?: Ref<HTMLDivElement> | undefined`: Optional tree ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/org-chart.tsx) | [Manifest](https://tidalui.com/examples/org-chart.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useState } from "react";

import { TidalOrgChart, type TidalOrgPerson } from "./components/ui/org-chart";

import "./components/ui/org-chart.css";

import "./components/ui/tree-view.css";

function tidalExampleAvatarDataUri(seed: unknown) {
  const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI";
  const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"];
  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><rect width="96" height="96" rx="48" fill="${color}"/><circle cx="48" cy="38" r="17" fill="white" fill-opacity=".92"/><path d="M18 92c3-22 15-34 30-34s27 12 30 34" fill="white" fill-opacity=".92"/></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

function tidalExampleImageDataUri(label: string) {
  const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image";
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 675"><defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop stop-color="#171717"/><stop offset="1" stop-color="#555555"/></linearGradient></defs><rect width="1200" height="675" fill="url(#g)"/><circle cx="950" cy="100" r="260" fill="white" fill-opacity=".08"/><text x="80" y="570" fill="white" font-family="system-ui,sans-serif" font-size="64" font-weight="700">${safeLabel}</text></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

export const orgPeople: readonly TidalOrgPerson[] = [
  {
    id: "jules",
    name: "Jules Morgan",
    role: "Chief executive",
    managerId: null,
    imageSrc: tidalExampleAvatarDataUri("01"),
    detail: "Sets the product direction and supports the leadership team.",
  },
  {
    id: "maya",
    name: "Maya Chen",
    role: "Head of product",
    managerId: "jules",
    imageSrc: tidalExampleAvatarDataUri("02"),
    detail: "Leads product design, research, and roadmap planning.",
  },
  {
    id: "dev",
    name: "Dev Patel",
    role: "Head of engineering",
    managerId: "jules",
    imageSrc: tidalExampleAvatarDataUri("03"),
  },
  {
    id: "sara",
    name: "Sara Wilson",
    role: "Product designer",
    managerId: "maya",
    imageSrc: tidalExampleAvatarDataUri("04"),
  },
  {
    id: "noah",
    name: "Noah Reed",
    role: "Product manager",
    managerId: "maya",
    imageSrc: tidalExampleAvatarDataUri("05"),
  },
  {
    id: "lena",
    name: "Lena Brooks",
    role: "Software engineer",
    managerId: "dev",
    imageSrc: tidalExampleAvatarDataUri("06"),
  },
];

export function OrgChartDemo() {
  const [selected, setSelected] = useState<string | null>("maya");
  const [expanded, setExpanded] = useState<readonly string[]>([
    "jules",
    "maya",
    "dev",
  ]);
  return (
    <TidalOrgChart
      title="People & reporting"
      description="Explore the team and its reporting relationships."
      people={orgPeople}
      selectedId={selected}
      expandedIds={expanded}
      onSelectedChange={setSelected}
      onExpandedChange={setExpanded}
    />
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <OrgChartDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Consumer-owned people use unique nonblank IDs, names, roles, and known managerId or null. Cycles and invalid selections fail visibly. Up to200 people form one or more reporting trees. Accepted Tree view supplies keyboard navigation, expansion, selection and focus recovery. Selected-person context shows exact manager and direct-report relationships. Controlled callbacks own every selection and expansion. Native root/tree/item props and refs, optional decorative portraits, selected detail/action slots, heading levels, RTL and narrow stacked layouts are supported. No organization changes, fetching, messaging or persistence occurs. Aggregate disabled state owns root semantics and makes the action slot inert. Focused relationship controls that disappear or become disabled recover only from the exact source/body to the persistent profile heading or root; unrelated focus is preserved.
