OrganizationChart visualizes hierarchical organization data.
import { OrganizationChart } from 'primereact/organizationchart';
OrganizationChart requires a collection of TreeNode instances as a value.
<OrganizationChart value={data} />
Custom content instead of a node label is defined using the nodeTemplate property.
<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.
<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.
<OrganizationChart value={data} nodeTemplate={nodeTemplate} />
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.
Key | Function |
---|---|
tab | Moves focus through the focusable elements within the chart. |
enter | Toggles the expanded state of a node. |
space | Toggles the expanded state of a node. |
numpad enter | Toggles the expanded state of a node. |