Chart Card

Card wrapper for charts with a title, optional description and a minimum height body. Pairs with the area, bar and donut charts in a React dashboard.

src/registry/ui/chart-card.tsx/r/chart-card.json

Installation#

bash
npx shadcn@latest add @minidev/chart-card

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/chart-card.json

Usage#

tsx
import { ChartCard } from "@/components/ui/chart-card"

export function Example() {
  return (
    <ChartCard className="w-full max-w-xl" title="Signups" description="Last 14 days">
      <div className="flex h-40 items-end gap-1">
        {[40,55,48,70,62,80,75,90,88,95,92,100,110,120].map((h,i)=>(
          <div key={i} className="flex-1 rounded-sm bg-accent/80" style={{ height: `${h/1.4}%` }} />
        ))}
      </div>
    </ChartCard>
  )
}

API reference#

ChartCard props
PropTypeDefault
title*React.ReactNode-
descriptionReact.ReactNode-
childrenReact.ReactNode-
classNamestring-

* required

Examples#

All chart components

Learn more