Patterns

Org chart

Five layouts (card, gradient, avatar, compact, list), rounded connectors, teams that fold, department colours, pan and zoom, fit, expand and collapse all.

A Wavi Pro component

The live example is open to everyone. The source comes with a Wavi Pro licence: add it with one command, or copy it below.

Get Pro
Selected: Nusrat Jahan · Chief Operating Officer
100%

Drag the background to move, Ctrl/⌘ + wheel or the toolbar to zoom; the counts fold and unfold each team.

Import#

The package for everything else, and the Pro component from where `add` puts it:

your-component.tsx
import { Badge, Segmented } from "@waveinno/ui";
import { OrgChart, type OrgChartVariant, type OrgNode } from "@/components/wavi-pro/org-chart";

Props#

Read from the source of this version, so they match the code exactly.

<OrgChart>

pro/org-chart.tsx
PropTypeDefaultDescription
datarequiredOrgNode—
variant"card" | "gradient" | "avatar" | "compact" | "list""card"
departmentsRecord<string, string>—Department → colour. Departments not listed get one from a palette.
defaultCollapsedstring[]—Ids folded at first. Or `collapseDepth` folds everything below a depth.
collapseDepthnumber—
selectedstring—
onSelect(node: OrgNode) => void—
heightnumber520Height of the chart box (not used by `list`).
classNamestring—

<Badge>

src/components/ui/badge.tsx
PropTypeDefaultDescription
dotbooleantrue
variant"soft" | "solid" | "outline" | "dot" | "gradient" | "live""soft"

Also takes HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badgeVariants>.

<Segmented>

src/components/ui/segmented.tsx
PropTypeDefaultDescription
valuerequiredT—
onChangerequired(v: T) => void—
optionsrequiredSegmentedOption<T>[]—
classNamestring—
ariaLabelstring—
variantkeyof typeof TRACK"pill"
sizekeyof typeof SIZES"sm"
fullWidthbooleanfalseStretch to the container, options sharing the width equally.

Add it to your project#

With your licence key, this writes the component to components/wavi-pro/ and installs anything it needs:

$ npx @waveinno/ui add org-chart --key <your licence key>

Source#

Or copy the file yourself. It imports only from @waveinno/ui, lucide-react and React (and Radix where noted).

The source comes with Wavi Pro

One payment for every Pro component, block and template, with every update.

Get Pro

Install#

If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.

$ npm install @waveinno/ui