Skip to main content

Installation

Install the package with your favorite package manager:

npm install d3-graph-react

All D3 dependencies (d3-force, d3-zoom, d3-drag, d3-selection) are bundled — you don't need to install D3 yourself.

Requirements

RequirementVersion
react^18.2
react-dom^18.2

TypeScript is fully supported out of the box — type definitions ship with the package, no @types/* install needed.

Verify the setup

Import the component anywhere in your app:

import { Graph } from "d3-graph-react";

If that compiles, you're ready to build your first graph — head over to the Quick Start.