Animated bar, line, area, pie, donut and radar charts with hover tooltips, built without a charting library.
One data array of { label, value } drives the bar, line, pie and donut charts. Series charts (multi-area, radar) take labels and series instead, and two share charts, donut-legend and stacked-bar, are the ones on the Book Appointment page.
What it is.Shadcn Chart (ChartBlock) draws eleven chart types from a type prop: bar, line, pie, donut, donut-legend, stacked-bar, traffic-sources, visitors-by-country, metrics-overview, multi-area and radar. Most read a data array of { label, value }. multi-area and radar read labels and series, and metrics-overview reads metrics.
How it is built. Plain SVG and HTML with no recharts, chart.js or gsap. Marks animate in once the chart scrolls into view, every chart opens a tooltip on hover or keyboard focus, and the colours are shades of the theme accent, so every preset on the Themes page restyles it. Installing it also adds the animated icon set.
When to use it. Analytics cards, revenue trends, category breakdowns and reporting dashboards.
For AI agents
Hand your agent this brief or the Markdown page, not a screenshot.
When to use
Analytics cards, revenue trends
Category breakdowns, version or score comparisons, reporting dashboards
Multi-area and radar: one entry per layer or tab, with one value per label. The first layer sits on top and takes the accent; later ones are greys. Radar opens on the last series.
baseline
{ label: string, values: number[] }
undefined
Radar only: a dashed outline to compare each version against.
centerLabel, hoverLabel
string
"largest", the share's name
Donut with legend: the caption under the centre value at rest, and while a share is hovered.
showTotal
boolean
false
Donut with legend: show the total in the centre at rest instead of the largest share.
signUps
number
412
Traffic sources only: sign-ups in the period, for the conversion rate.
showCodes
boolean
true
Visitors by country only: the 2-letter ISO badges.
metrics
MetricTabItem[]
4 sample tabs
Metrics overview only: tabs with points, icon, currency and a change percentage.
className
string
undefined
Classes for the outer wrapper.
Works with other components
Combine ChartBlock with Data Grid for editable metrics tables, Data Maps for geographic breakdowns, and Card for dashboard KPI panels.
Place it inside a Dashboard layout alongside tables and filters.
Does ChartBlock depend on Recharts or Chart.js?
No. ChartBlock draws everything with SVG and HTML. The registry item adds only the animated icon set, and the file imports nothing from next/*.
How do I prevent vertical layout shift when charts load?
Pass a fixed pixel height, for example height={300}, which is already the default for bar, line, pie and donut. Width stays 100% responsive. The legend and card charts size to their content, so give their wrapper a min-height if you need to reserve space.
How do I make an area chart with ChartBlock?
There is no "area" type. Use type="line" for one series, where showArea fills a gradient under the curve, or type="multi-area" with labels and series to stack several. The curve is smooth and never overshoots your data, so there is no option for straight segments.
How do I show currency or units on ChartBlock values?
Set valuePrefix="$" or valueSuffix="%"; both apply to the tooltip, the axis and the legend. Axis labels are abbreviated (1.2K), tooltips show the full number. In metrics-overview, give a tab currency: "USD" and its values are formatted with Intl.NumberFormat.
How do I set the colour of each share?
Give a data point its own color to pin it, such as grey for an "Other" bucket. Other shares take colors in order, wrapping when there are more shares than colours. With no colors, shares are shades of color (the theme accent by default), so presets restyle them.
Is ChartBlock keyboard and screen-reader accessible?
Mostly. Bar, line, area and metrics charts take focus: ArrowLeft, ArrowRight, Home and End step through the points and Escape clears the tooltip. Pie and donut slices and legend rows are focusable and show the same tooltip, and the tabs and toggles are real tablists and radio groups. Radar axes show their tooltip on hover only. Under prefers-reduced-motion charts render in their final state with no entrance or morph.