shadcn chart tutorial: an animated chart in Next.js

To add an animated shadcn chart to Next.js, install a chart from a shadcn registry with the CLI, render it from an App Router page and pass your data as props. mebius.design’s free Income Overview chart installs with one command and no account, and animates with anime.js.

8 min read · Updated Nov 22, 2026 · React + Tailwind

What do you need to add a shadcn chart to Next.js?

From the Next.js docs and the mebius.design registry, checked on 22 Nov 2026.

A shadcn chart is source code that the shadcn CLI copies into your project, so the project needs Tailwind CSS v4 and a components.json; this tutorial uses Next.js with the App Router. The Next.js installation docs say create-next-app --yes sets up TypeScript, Tailwind CSS, ESLint, the App Router and Turbopack, with the @/* import alias.

This tutorial uses the Income Overview chart from mebius.design’s free shadcn charts: a card with the year’s income, a badge with the change on last year, and one glossy bar per quarter against a target. The Income Overview chart is one of the open starter items, so its code is MIT and installs from its URL.

The Income Overview chart at a glance
Installnpx shadcn@latest add https://www.mebius.design/r/charts-income-overview.json
LicenseMIT, no account needed
Files9 files, plus the chart theme in globals.css
npm packagesanimejs ^4.5.0, plus shadcn’s cn helper
RenderingA Client Component you render from a Server Component page
SizeAs wide as its container (418 px in Figma); 584 px tall with four quarters
ThemeOne light design, its colors scoped to the card
Checked on22 Nov 2026, installed with shadcn 4.23.0

How do you install a shadcn chart from the mebius.design registry?

Four steps, tested with shadcn 4.23.0 on 22 Nov 2026.

  1. Create the app

    npx create-next-app@latest my-dashboard --yes gives you the App Router and Tailwind CSS v4.

  2. Set up shadcn

    npx shadcn@latest init in the project folder writes components.json and the cn helper.

  3. Add the chart

    npx shadcn@latest add https://www.mebius.design/r/charts-income-overview.json follows the chart’s registry dependencies, installs animejs and writes the files.

  4. Check what landed

    components/income-overview-chart.tsx, three parts in components/ui, three hooks, two helpers in lib/, and the chart theme at the end of app/globals.css.

All 62 mebius.design charts install the same way: the open starter charts from their URL, the rest by name with a free account and a token from Settings › Tokens. AI editors can also install them over the shadcn or mebius MCP server (setup guide).

How do you use a shadcn chart in a Next.js App Router page?

A Server Component loads the data; the chart is a Client Component.

The Income Overview chart file starts with "use client", and a Server Component page can still render it: the page reads the numbers on the server and passes them down as props. The Next.js "use client" docs require those props to be serializable, so arrays and numbers cross over and functions don’t.

app/dashboard/page.tsx
import { Suspense } from "react"

import { IncomeOverviewChart, type IncomeOverviewPeriod } from "@/components/income-overview-chart"

type IncomeRow = { quarter: number; amount: number }

// Swap this for a query to your database or API.
async function getQuarterlyIncome(year: number): Promise<IncomeRow[]> {
  const sample: Record<number, number[]> = {
    2025: [48_900, 55_120, 61_300, 70_450],
    2026: [61_240.5, 74_980, 88_310.25, 52_100],
  }
  return (sample[year] ?? []).map((amount, i) => ({ quarter: i + 1, amount }))
}

const sum = (rows: IncomeRow[]) => rows.reduce((total, row) => total + row.amount, 0)

async function IncomeOverview({ year }: { year: number }) {
  const [rows, lastYear] = await Promise.all([getQuarterlyIncome(year), getQuarterlyIncome(year - 1)])
  const periods: IncomeOverviewPeriod[] = rows.map((row) => ({
    id: `q${row.quarter}`,
    label: `Q${row.quarter}`,
    amount: row.amount,
  }))

  return (
    <IncomeOverviewChart
      className="max-w-[418px]"
      title={`Income ${year}`}
      periods={periods}
      target={100_000}
      change={sum(rows) - sum(lastYear)}
      changeLabel={`vs ${year - 1}`}
    />
  )
}

export default function DashboardPage() {
  return (
    <main className="p-6">
      <Suspense fallback={<div className="h-[584px] w-full max-w-[418px] rounded-3xl bg-neutral-100" />}>
        <IncomeOverview year={2026} />
      </Suspense>
    </main>
  )
}

The <Suspense> boundary lets the rest of the page show while the query runs. The Next.js data fetching docs offer that, or a "use cache" directive on the data function, for data read at request time.

How do you feed the Income Overview chart your own data?

The props, from the chart’s own docs in the mebius.design registry.

Callbacks are functions, so they live in a small Client Component of your own, which the page renders with the rows from its query:

components/income-card.tsx
"use client"

import * as React from "react"

import { IncomeOverviewChart, type IncomeOverviewPeriod } from "@/components/income-overview-chart"

export function IncomeCard({ periods, reportUrl }: { periods: IncomeOverviewPeriod[]; reportUrl: string }) {
  const [quarter, setQuarter] = React.useState<number | null>(null)
  const pinned = quarter === null ? undefined : periods[quarter]

  return (
    <section className="flex max-w-[418px] flex-col gap-3">
      <IncomeOverviewChart
        periods={periods}
        index={quarter}
        onIndexChange={(next) => setQuarter(next)}
        onInsightClick={() => window.location.assign(reportUrl)}
      />
      <p className="text-sm text-neutral-600">
        {pinned ? `${pinned.label} is pinned. Click it again to let go.` : "Click a quarter to pin its amount."}
      </p>
    </section>
  )
}

How does the mebius.design chart animation work?

Read from the chart’s source: anime.js v4, no Recharts.

Every mebius.design chart draws its own HTML or SVG and animates it with anime.js. The hook in hooks/use-chart-motion.ts builds the entrance as one paused anime.js timeline, renders its first frame before the browser paints, and plays it once a quarter of the card is in view. In the Income Overview chart:

After the entrance, the Income Overview chart animates changes: new data grows or shrinks each bar from its current width, and the total and the value tag count from the old number to the new one. Pointing at a quarter dims the other bars and slides the tag over.

With prefers-reduced-motion set to reduce, nothing animates. The server renders the finished chart, so the HTML shows the real figures before any JavaScript runs.

shadcn/ui’s chart component leaves motion to Recharts, whose Bar takes isAnimationActive (default "auto") and animationDuration (default 400 ms), checked on 22 Nov 2026.

How do you change the colors of a mebius.design chart?

Theme variables scoped to the card, or the classes in the file.

The chart theme that the install adds to globals.css sets the Keitoto palette (surfaces, text, and blue, green, orange, purple, yellow and error scales) on every element with data-charts, and each mebius.design chart’s card carries that attribute. Your shadcn theme doesn’t reach the card, and the card doesn’t change your app’s colors.

The Income Overview bars read three of those variables: --primary-blue-600, --primary-blue-400 and --primary-blue-200. Extra props go to the card’s div, so a style prop recolors one card:

components/violet-income-card.tsx
import type { CSSProperties } from "react"

import { IncomeOverviewChart } from "@/components/income-overview-chart"

// The bars' gradient, from the chart theme: set on the card, it recolors this card only.
const violet = {
  "--primary-blue-600": "#6d28d9",
  "--primary-blue-400": "#8b5cf6",
  "--primary-blue-200": "#c4b5fd",
} as CSSProperties

export function VioletIncomeCard() {
  return <IncomeOverviewChart className="max-w-[418px]" style={violet} />
}

To change the blue of every mebius.design chart card at once, set the same variables on [data-charts] below the chart theme:

app/globals.css
/* after the chart theme the install added */
[data-charts] {
  --primary-blue-600: #6d28d9;
  --primary-blue-400: #8b5cf6;
  --primary-blue-200: #c4b5fd;
}

How is a mebius.design chart different from shadcn/ui’s chart component?

shadcn/ui’s docs checked on 22 Nov 2026.

shadcn/ui’s chart component is a layer on Recharts v3. npx shadcn@latest add chart adds ChartContainer, a ChartConfig type for labels and colors, and tooltip and legend parts; you write the Recharts chart yourself. Its colors are CSS variables such as --chart-1, set under :root and .dark, so shadcn/ui charts follow your theme and dark mode. It is the better pick for standard charts in your own look.

mebius.design’s charts are finished dashboard cards instead: title, figures and controls included, drawn without Recharts and matched to a Figma file. Both kinds can share a page, because each mebius card keeps its theme to itself. More options are compared in Best shadcn charts.

FAQ

Answers to what people ask most.

Is the Income Overview chart free for commercial use?

Yes. Its code is MIT: the Income Overview chart is one of mebius.design’s 20 open starter items, which install from their URL with no account. The other charts and the Figma file of all 62 need a free account; they are free to use in your projects under the mebius.design license, which doesn’t allow redistributing them.

Does a shadcn chart work with Next.js Server Components?

Yes. The mebius.design charts are Client Components, so a Server Component page can render them and pass data such as arrays and numbers. Functions like onInsightClick need a Client Component wrapper, because props sent from the server must be serializable.

Do mebius.design charts support dark mode?

No. Each mebius.design chart card has one light design, with its colors scoped to the card, so it stays white on a dark page. shadcn/ui’s own charts follow your .dark theme.

Can an AI editor install the chart for me?

Yes. Claude Code or Cursor can run the shadcn add command, or use the mebius MCP server, which returns each chart’s source and usage docs with a free account. Setup is in shadcn MCP: install UI components.

Item pages, kits and guides this guide uses.