Nivo Rocks: Exploring the Nivo charts Website and Playground
Nivo rocks explained: how the nivo.rocks website works, its live chart playground, controls, code and data tabs, Storybook and practical tips.
Read guide
Nivo/core, published on npm as @nivo/core, is the shared foundation that sits underneath Nivo chart packages. Whenever you install @nivo/bar, @nivo/line or another chart, the documentation pairs it with this core package. Understanding what it contains clarifies why it is needed and how it shapes theming, motion and container behaviour across every chart.
Nivo is split into many packages so projects only install the charts they render. Splitting code this way creates a challenge, because every chart still needs common behaviour such as theme handling, animation settings and container logic. The core package solves this by holding that shared functionality in one place.
Keeping common code centralised means a theme or motion setting behaves the same way in a bar chart and a sunburst. It also reduces duplication, since chart packages import shared helpers instead of each carrying their own copy.
The exact contents evolve between releases, but the package consistently focuses on infrastructure rather than specific chart shapes. Chart packages and supporting packages such as axes and legends build on top of these pieces.
| Area | What it handles |
|---|---|
| Theming | Default theme and helpers that merge your theme object |
| Containers | Context providers that supply theme, motion and tooltip handling to charts |
| Responsive sizing | Logic used by responsive wrappers to measure parent elements |
| Motion | Motion configuration presets used with react-spring |
| Utilities | Shared helpers for formatting, defs, gradients and patterns |
When you pass a theme prop to a chart, it is merged with defaults and made available to every part of that chart, including axes, grid lines, labels, legends and tooltips. The core package manages this process, which is why one theme object can style many different chart types consistently.
This design also allows supporting packages to read theme values without extra wiring. A legend from @nivo/legends, for example, picks up the text styling defined in your theme automatically.
const theme = {
text: { fontFamily: 'Poppins, sans-serif', fontSize: 12, fill: '#4A5A70' },
grid: { line: { stroke: '#E2EAED' } },
tooltip: { container: { borderRadius: 8 } },
}
<ResponsiveBar data={data} keys={['value']} indexBy="country" theme={theme} />
<ResponsiveLine data={series} theme={theme} />
Nivo animations rely on react-spring, and the core package defines how motion settings are passed into charts. The motionConfig prop accepts named presets, such as gentle, wobbly or stiff, or a custom configuration object with tension and friction values.
Turning animation off with animate set to false is helpful for reports, print views or users who prefer reduced motion. Because motion handling is shared, the same props behave identically across chart types.
Responsive components measure their parent element and pass the resulting width and height to the chart. Shared sizing logic keeps this behaviour consistent, which is why every responsive chart has the same requirement: the parent must have a defined height.
A missing height is the most frequent cause of an invisible chart. Setting a pixel height, a viewport-based height or a grid cell with a fixed size gives the measurement something to work with.
Install @nivo/core alongside your chart packages using the same version for all of them. Matching versions matter, because chart packages are built and tested against a specific core release.
npm install @nivo/core @nivo/bar @nivo/line
Problems sometimes appear after updating a single chart package without updating core. Symptoms include TypeScript errors, missing context warnings or themes not applying as expected. Aligning every @nivo package to the same version usually resolves these issues immediately.
Lock files can occasionally keep an older version installed. Checking the installed versions with your package manager confirms that every Nivo package matches.
| Symptom | Check |
|---|---|
| Theme ignored | Core and chart versions match |
| Type errors on props | All @nivo packages updated together |
| Duplicate package warnings | Lock file resolves a single core version |
Alongside @nivo/core, several supporting packages provide features that many charts share. @nivo/axes draws axes and grid lines, @nivo/legends renders legends, @nivo/tooltip handles tooltip display, @nivo/colors manages colour schemes and @nivo/scales computes scales.
These packages are installed automatically as dependencies of chart packages. Most applications never import them directly, though advanced users sometimes use them when building custom layers or entirely custom charts.
| Package | Responsibility |
|---|---|
| @nivo/axes | Axes, ticks and grid lines |
| @nivo/legends | Legend layout and symbols |
| @nivo/tooltip | Tooltip containers and positioning |
| @nivo/colors | Colour schemes and inherited colours |
| @nivo/scales | Linear, band, time and other scales |
Custom layers let you draw extra elements inside a chart, such as target lines or centre labels. Inside a layer you receive computed values like scales and dimensions, and theme values remain available so custom elements can match the rest of the chart.
Reusing theme settings in custom layers keeps typography and colours consistent. That consistency is one of the main benefits of the shared core design.
Reading the core package source helps when a theme value does not apply as expected or when building advanced layers. The code is organised by feature, so theming, motion and container logic are easy to locate in the repository.
Treat @nivo/core as infrastructure that should stay in sync with the rest of your Nivo packages. Small habits prevent most issues and keep upgrades routine.
Nivo/core is the shared layer that gives every Nivo chart consistent theming, motion, sizing and utilities. Installing it with your chart packages, keeping versions aligned and defining one shared theme turns a collection of separate charts into a coherent visual system.
With the core in place, exploring additional chart types becomes simple. Continue with the customisation article to see theming and colours in practice.