OrganizationChart

OrganizationChart visualizes hierarchical organization data.


import { OrganizationChart } from 'primereact/organizationchart';
         

OrganizationChart requires a collection of TreeNode instances as a value.

Argentina
    
Argentina
    
Argentina
Croatia
France
    
France
Morocco

<OrganizationChart value={data} />
         

Custom content instead of a node label is defined using the nodeTemplate property.

Argentina
Argentina
    
Argentina
Argentina
    
Argentina
Argentina
Croatia
Croatia
France
France
    
France
France
Morocco
Morocco

<OrganizationChart value={data} nodeTemplate={nodeTemplate} />
         

Nodes can be selected by defining selectionMode along with a value binding with selection and onSelectionChange properties. By default only one node can be selected, set selectionModeas multiple to select more than one.

Amy ElsnerAmy ElsnerCEO
    
Anna FaliAnna FaliCMO
    
Sales
Marketing
Stephen ShawStephen ShawCTO
    
Development
UI/UX Design

<OrganizationChart value={data} selectionMode="multiple" selection={selection} onSelectionChange={(e) => setSelection(e.data)} nodeTemplate={nodeTemplate} />
         

Styling a specific node is configured with className and style options of a TreeNode.

Amy ElsnerAmy ElsnerCEO
    
Anna FaliAnna FaliCMO
    
Sales
Marketing
Stephen ShawStephen ShawCTO
    
Development
UI/UX Design

<OrganizationChart value={data} nodeTemplate={nodeTemplate} />
         

Following is the list of structural style classes.

NameElement
p-organizationchartContainer element.
p-organizationchart-tableTable container of a node.
p-organizationchart-linesConnector lines container.
p-organizationchart-nodesContained of node children.
p-organizationchart-line-rightRight side line of a node connector.
p-organizationchart-line-leftLeft side line of a node connector.
p-organizationchart-line-topTop side line of a node connector.
Accessibility guide documents the specification of this component based on WCAG guidelines, the implementation is in progress.

Screen Reader

Component currently uses a table based implementation and does not provide high level of screen reader support, a nested list implementation replacement is planned with aria roles and attributes aligned to a tree widget for high level of reader support in the upcoming versions.

Keyboard Support

KeyFunction
tabMoves focus through the focusable elements within the chart.
enterToggles the expanded state of a node.
spaceToggles the expanded state of a node.