Network Chart
Network chart for relations: a force graph, an arc diagram, a tree and a radial tree.
Playground
Installation
Network Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.
The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.
Then import what you need:
import {
NetworkChart,
NetworkChartProps,
NetworkChartVariant,
} from "@wunderui/react/charts"Then use it:
import { NetworkChart } from "@wunderui/react/charts"
const nodes = [{ id: "Nora" }, { id: "Daniel" }, { id: "Priya" }]
const links = [
{ source: "Nora", target: "Daniel" },
{ source: "Nora", target: "Priya" },
]
export function TeamNetwork() {
return <NetworkChart nodes={nodes} links={links} label="Who works with whom" />
}Expected result: You see three nodes, with Nora joined to both of the others.
When to use
Use Network Chart for
- Relations between things: who works with whom, which service calls which
- A force graph for clusters, an arc diagram for ordered nodes
- An organisation or a folder structure as a tree or a radial tree
Use something else for
- Sankey Chart for flows with quantities between stages
- Treemap for parts of a hierarchy by size
- Sunburst for a hierarchy as rings
- Timeline Chart for items on a time scale
States
Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.
Keyboard interactions
The plot is focusable: arrow keys step through the nodes in data order and the live region reads each node with its connections by name. A hidden data table adds a Connected to column.
- TaborShiftTab
- Moves focus to the plot and away from it. The plot is one tab stop; so is every legend badge.
- ArrowRightorArrowLeft
- Moves to the next or previous node. The tooltip follows, and a live region announces the one you are on. The first press starts at the first one (Left: the last one).
- HomeorEnd
- Jumps to the first or last node.
- Escape
- Clears the active point.
- EnterorSpace
- On a legend badge of a ChartCard: switches its series off or on. The last visible series stays on.
Behavior and motion
What the chart does on its own and what the page decides.
- Graphs and trees
- Graph variants take nodes (id, label, group, size) and links (source, target, value), and tree variants take a hierarchy of names and children. Groups set colours and legend order.
- Layout
- The force layout is calculated once per data set and fitted to the frame, so nodes do not jump on resize. Nodes are sized by size, or by their number of links.
- Labels
- Names stand beside the nodes, shortened to fit. Dense graphs show the labels of the hovered node and its neighbours.
- Bad links
- Links to unknown nodes and self loops are ignored.
- Loading, empty and error
- The chart keeps its size while it loads, is empty or fails, so the card never jumps. Add a retry handler to show a Try again button.
- Legend
- A ChartCard shows the series as badges. With two or more series each badge switches its series off (the last visible one stays on), and a static legend is possible for roles instead of series.
- Size
- The chart fills its container's width and the height prop sets the plot height. It never scales its text: labels keep their size at every width.
Motion
The enter sequence and the hover follow the motion tokens of the library.
- Pop in and draw
- Nodes pop in and links draw the first time the chart is in view, after loading, and when the key or the data changes. Turn it off with the animate prop.
- Hover
- Hovering a node highlights its neighbours and dims the rest.
- Reduced motion
- With reduced motion the enter sequence is off and the chart appears at once. Tooltip, crosshair and every state still work.
Anatomy
NetworkChart draws relations: a force-directed graph, an arc diagram, a tree and a radial tree. Nodes pop in and links draw; hovering a node highlights its neighbours and dims the rest.
Team network
| label | Group | Connections | Connected to |
|---|---|---|---|
| Nora | Product | 3 | Daniel, Priya, Tomás |
| Daniel | Product | 3 | Nora, Maya, Support |
| Priya | Design | 2 | Nora, Maya |
| Maya | Design | 2 | Daniel, Priya |
| Tomás | Sales | 2 | Nora, Support |
| Support | Support | 2 | Tomás, Daniel |
Takes nodes (id, label, group, size) and links (source, target, value) for the graph variants, or a tree of name and children for the tree variants. Groups set colours and legend order.
- data-slot="chart-plot"
The focusable region. Arrow keys walk its marks and the live region reads each one as the tooltip shows it.
- data-slot="chart-marks"
Nodes sized by size (or degree) and links between them. The force layout is calculated once per data set and fitted to the frame, so nodes do not jump on resize.
Names beside each node, shortened to fit. Dense graphs show labels for the hovered node and its neighbours.
- data-slot="chart-tooltip"
The group and the number of links (reports, on the tree variants).
- data-slot="chart-message"
Muted dots on the force graph, muted bars on the tree and arc variants. Links to unknown nodes and self loops are ignored.
A table of the nodes with group and degree for screen readers.
Best practices
- Do
Keep a force graph below about 60 nodes and use size for importance. Above that, filter or aggregate first.
- Do
Use a tree for strict hierarchies such as an org chart or file structure, and the arc diagram for ordered nodes with many links.
- Do
Colour by group and keep to five groups, with the names in the legend.
- Don’t
Don't read distance in a force graph as a measurement. The layout places connected nodes close, but position has no axis.
- Don’t
Don't use it for tabular data. If the question is a value per item, a BarChart answers it faster.
API reference
One table for NetworkChart. It is a plain component, so the table lists every prop, and the ChartCard around it takes its own props (the chart works without one).
Takes nodes (id, label, group, size) and links (source, target, value) for the graph variants, or a tree of name and children for the tree variants. Groups set colours and legend order.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("network-chart")The full library index for assistants is at /llms.txt.