Next Chapter Begins 🚀Read the full story
styledData

OrganizationChart

OrganizationChart visualizes hierarchical organization data.

  • AE
    Amy Elsner
    Founder & CEO
    • AJ
      Asiya Javayant
      Product Lead
      • AF
        Anna Fali
        UX Designer
      • BD
        Bernardo Dominic
        Product Manager
    • OL
      Onyama Limba
      Engineering Lead
      • ES
        Elwin Sharvill
        Frontend Engineer
      • SS
        Stephen Shaw
        Backend Engineer
preview

Usage#

import { OrganizationChart } from '@primereact/ui/organizationchart';

OrganizationChart.Nodes calls its render function once per node and builds the connectors and nesting for you, no recursion in your code. Each node is identified by uKey.

<OrganizationChart.Root value={data}>
    <OrganizationChart.Nodes>
        {({ node }) => (
            <OrganizationChart.Node uKey={node.key}>
                <OrganizationChart.Content>
                    <OrganizationChart.Label>{node.label}</OrganizationChart.Label>
                </OrganizationChart.Content>
            </OrganizationChart.Node>
        )}
    </OrganizationChart.Nodes>
</OrganizationChart.Root>

Examples#

Basic#

A basic chart renders a collection of nodes from the value.

  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
basic-demo

Collapsible#

Add OrganizationChart.Toggle with OrganizationChart.ToggleIndicator and its match property of expanded or collapsed to let a node collapse its subtree. A node is collapsible when it has children.

  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
collapsible-demo

Controlled#

Drive expansion programmatically with the collapsedKeys and onCollapsedChange properties. A key present with true is collapsed; absent keys stay expanded.

  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
controlled-demo

Content#

Render anything inside OrganizationChart.Content; the node payload carries your own data fields.

  • AWS Cloud
    us-east-1
    • Compute
      Workloads & runtime
      • EC2
        Virtual servers
      • Lambda
        Serverless functions
    • Storage
      Data persistence
      • S3
        Object storage
      • RDS
        Managed databases
    • Networking
      Edge & access
      • CloudFront
        Global CDN
      • IAM
        Access policies
content-demo

Selection#

Single#

Set selectionMode to single to keep at most one node selected. Bind the selection with selectionKeys and onSelectionChange.

Selected: —
  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
single-selection-demo

Multiple#

With multiple, each node toggles independently.

Selected: —
  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
multiple-selection-demo

Checkbox#

In checkbox mode, OrganizationChart.Selection exposes isSelected, isPartiallySelected and toggle. Selecting a node cascades to its descendants and reflects a partial state on its ancestors.

  • Founder
    • Product Lead
      • UX/UI Designer
      • Product Manager
    • Engineering Lead
      • Frontend Developer
      • Backend Developer
checkbox-selection-demo

Sub-Components#

See the Primitive API for OrganizationChart.Root, OrganizationChart.Nodes, OrganizationChart.Node, OrganizationChart.Content, OrganizationChart.Label, OrganizationChart.Toggle, OrganizationChart.ToggleIndicator and OrganizationChart.Selection.

Hooks#

See the Headless API for useOrganizationChart.

Accessibility#

See OrganizationChart Primitive for WAI-ARIA compliance details and keyboard support.