Network

@nivo/network

A network component connecting nodes with links using various forces, the resulting layout will depends on linkDistance, centeringStrength and repulsivity, so you should play with those parameters in order to achieve the desired result.

You can also add some extra constrains via distanceMin and distanceMax.

The responsive alternative of this component is ResponsiveNetwork.

Please note that you can also use the useNetwork React hook if you want to handle the rendering by yourself, it accepts an object with almost the same props as the component and returns computed nodes & links.

53 nodes
Actions Logs
Start interacting with the chart to log actions
Base
{ nodes: NetworkInputNode[], links: NetworkInputLink[] }required

Chart data defining nodes and links.

numberrequired

Chart width.

numberrequired

Chart height.

numberoptionaldefault:'Depends on device'

Adjust pixel ratio, useful for HiDPI screens.

supportsvgcanvas
objectoptional
px
px
px
px

Chart margin.

Simulation
number | string | (link: Link) => numberoptional

Control links' distance.

numberoptionaldefault:1

Control how much the centering force affects nodes positioning.

numberoptionaldefault:10

Control how nodes repel each other.

numberoptionaldefault:1

Sets the minimum distance between nodes for the many-body force.

numberoptionaldefault:Infinity

Sets the maximum disteance between nodes for the many-body force.

numberoptionaldefault:120

Adjust the simulation quality.

Style
Themeoptional

Define style for common elements such as labels, axes…

Nodes
NetworkNodeComponentoptionaldefault:'NetworkNode'

Custom node component for the SVG implementation.

supportsvgcanvas
NetworkNodeCanvasRendereroptional

Custom node rendering for the canvas implementation.

supportsvgcanvas
number | (node: InputNode) => numberoptionaldefault:12
dynamic: (node: InputNode) => node.size

Control nodes' size.

number | (node: InputNode) => numberoptionaldefault:18
dynamic: (node: InputNode) => node.size * 1.5

Control active nodes' size.

number | (node: InputNode) => numberoptionaldefault:8
px

Control inactive nodes' size.

string | (node: InputNode) => stringoptionaldefault:'#000000'

Control nodes' color.

number | (node: NetworkComputedNode) => numberoptionaldefault:0
px

Control nodes' border width.

InheritedColorConfig<NetworkComputedNode>optionaldefault:{"from":"color"}
inheritthemecustom
inherited property
color
modifiers
darker

Control nodes' border color.

Links
Interactivity
booleanoptionaldefault:true
   

Enable/disable interactivity.

NetworkNodeTooltipComponentoptional

Custom tooltip component for nodes.

(node: NetworkComputedNode, event: MouseEvent) => voidoptional

onClick handler.

(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseEnter handler.

supportsvgcanvas
(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseMove handler.

supportsvgcanvas
(node: ComputedNode, event: MouseEvent) => voidoptional

onMouseLeave handler.

supportsvgcanvas
Annotations
AnnotationMatcher[]optionaldefault:[]

Annotations for nodes.

add annotation
Customization
('links' | 'nodes')[] | FunctionComponent<LayerProps>optionaldefault:['links', 'nodes', 'annotations']

Defines the order of layers and add custom layers.

Accessibility
stringoptional

Main element role attribute.

supportsvgcanvas
stringoptional

Main element aria-label.

supportsvgcanvas
stringoptional

Main element aria-labelledby.

supportsvgcanvas
stringoptional

Main element aria-describedby.

supportsvgcanvas
Motion
booleanoptionaldefault:true
   

Enable/disable transitions.

supportsvgcanvas
string | objectoptionaldefault:'gentle'
wobbly

Motion config for react-spring, either a preset or a custom configuration.

supportsvgcanvas