Chart

Animated SVG charts in the shadcn style with zero chart-library dependencies: area and line charts with monotone, linear or stepped curves that reveal left to right (and again when the range changes), grouped, stacked or horizontal bars that grow from the baseline, donut and pie slices that sweep in clockwise, and radial progress rings. Every chart shares one tooltip with dot, line or dashed indicators, arrow-key reading, a legend and a screen-reader table. Colors come from the theme's --chart-1…5 tokens, validated for color-blind separation; reduced-motion safe.

Area Chart

area-chart.tsx

Stacked gradient areas with a time-range switch; the reveal replays whenever the range changes.

Chart Area Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-area
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

fill?
"solid" | "gradient"

Gradient fades toward the baseline; solid keeps one translucent tone.

—
data
ChartDatum[]
—
index
string

Key of the x value in each datum (dates, months…).

—
series
ChartSeries[]
—
height?
number

Plot height in px. Default 250.

—
curve?
"step" | "natural" | "linear"

Default "natural" (smooth, never overshoots a point).

—
stacked?
boolean

Stack series on top of each other instead of overlapping them.

—
dots?
boolean

Draw a dot on every point.

—
showValues?
boolean

Print each point's value above it. Best for short series.

—
yAxis?
boolean

Show the y axis labels. Default false: gridlines carry the scale.

—
legend?
boolean

Show the legend. Default: when there are two or more series.

—
indicator?
"dashed" | "line" | "dot"
—
formatIndex?
((value: string) => string)

Formats x labels and the tooltip title.

—
formatValue?
((value: number) => string)
—
formatAxis?
((value: number) => string)
—
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Bar Chart

bar-chart.tsx

Grouped columns that grow from the baseline; hovering a category dims the rest and reads every series.

Chart Bar Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-bar

API Reference

data
ChartDatum[]
—
index
string

Key of the category label in each datum.

—
series
ChartSeries[]
—
layout?
"horizontal" | "vertical"

"vertical" draws columns; "horizontal" draws rows of bars.

vertical
stacked?
boolean

Stack series into one bar per category.

false
showValues?
boolean

Print each bar's value at its end.

false
radius?
number

Corner radius of the bar's data end, in px. Default 6.

6
height?
number

Plot height in px (vertical layout). Default 250.

250
valueAxis?
boolean

Show the value axis labels. Default false: gridlines carry the scale.

false
legend?
boolean

Show the legend. Default: when there are two or more series.

—
indicator?
"dashed" | "line" | "dot"
dot
formatIndex?
((value: string) => string)
(v) => v
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
formatAxis?
((value: number) => string)
(n: number) => COMPACT.format(n)
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Horizontal Bars

bar-chart.tsx

The same BarChart with layout="horizontal" and printed values: ranked categories read left to right.

Chart Horizontal Bars preview width

API Reference

data
ChartDatum[]
—
index
string

Key of the category label in each datum.

—
series
ChartSeries[]
—
layout?
"horizontal" | "vertical"

"vertical" draws columns; "horizontal" draws rows of bars.

vertical
stacked?
boolean

Stack series into one bar per category.

false
showValues?
boolean

Print each bar's value at its end.

false
radius?
number

Corner radius of the bar's data end, in px. Default 6.

6
height?
number

Plot height in px (vertical layout). Default 250.

250
valueAxis?
boolean

Show the value axis labels. Default false: gridlines carry the scale.

false
legend?
boolean

Show the legend. Default: when there are two or more series.

—
indicator?
"dashed" | "line" | "dot"
dot
formatIndex?
((value: string) => string)
(v) => v
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
formatAxis?
((value: number) => string)
(n: number) => COMPACT.format(n)
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Line Chart

line-chart.tsx

Smooth monotone lines with dots, a snapping cursor and one tooltip for every series.

Chart Line Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-line

API Reference

data
ChartDatum[]
—
index
string

Key of the x value in each datum (dates, months…).

—
series
ChartSeries[]
—
height?
number

Plot height in px. Default 250.

—
curve?
"step" | "natural" | "linear"

Default "natural" (smooth, never overshoots a point).

—
stacked?
boolean

Stack series on top of each other instead of overlapping them.

—
dots?
boolean

Draw a dot on every point.

—
showValues?
boolean

Print each point's value above it. Best for short series.

—
yAxis?
boolean

Show the y axis labels. Default false: gridlines carry the scale.

—
legend?
boolean

Show the legend. Default: when there are two or more series.

—
indicator?
"dashed" | "line" | "dot"
—
formatIndex?
((value: string) => string)

Formats x labels and the tooltip title.

—
formatValue?
((value: number) => string)
—
formatAxis?
((value: number) => string)
—
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Donut Chart

donut-chart.tsx

Slices sweep in clockwise; the hovered slice lifts and the center swaps from the total to its value and share. variant="pie" for a solid pie.

Chart Donut Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-donut

API Reference

data
DonutSlice[]

Parts of one whole. Keep it to five or fewer and fold the long tail into an "Other" slice; close values compare better as bars.

—
variant?
"donut" | "pie"

"donut" (default) leaves room for the center readout; "pie" is solid.

donut
size?
number

Diameter in px. Default 220.

220
thickness?
number

Ring thickness for the donut, in px. Default 32% of the radius.

—
totalLabel?
string

Center caption under the total. Default "Total".

Total
legend?
boolean

Show the legend under the chart. Default true.

true
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Radial Chart

radial-chart.tsx

Concentric progress rings with rounded caps that fill clockwise toward a target.

Chart Radial Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-radial

API Reference

data
RadialRing[]

One ring per item, outermost first. A single item makes a progress ring.

—
max?
number

The value a full ring represents. Default 100.

100
size?
number

Diameter in px. Default 220.

220
thickness?
number

Ring thickness in px. Default 14.

14
centerValue?
string

Center content when nothing is hovered. Default: first ring's share.

—
centerLabel?
string
—
legend?
boolean

Show the legend. Default: when there are two or more rings.

—
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Sparkline

sparkline.tsx

Word-sized trend line for stat tiles that ends on the latest value, with a spoken summary.

Chart Sparkline preview width

Install

$ bunx --bun shadcn add @karaui/sparkline

API Reference

data
number[]

Values in time order.

—
height?
number

Height in px; width fills the container. Default 40.

40
color?
string

Any CSS color. Default: the first `--chart-*` slot.

var(--chart-1, #2a78d6)
area?
boolean

Soft fill under the line. Default true.

true
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
label
string

What the values are, e.g. "Weekly revenue". Used in the spoken summary.

—
className?
string
—

Heatmap Chart

heatmap-chart.tsx

GitHub-style contribution calendar; cells fade in week by week and arrow keys read each day.

Chart Heatmap Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-heatmap

API Reference

data
HeatmapDatum[]

One entry per day; missing days count as zero, repeated days are summed.

—
weeks?
number

Columns to show, ending on the latest date in `data`. Default 53 (a year).

53
levels?
number

Intensity steps including the empty step. Default 5.

5
color?
string

Any CSS color for the strongest step. Default `--chart-1`.

seriesColor({}, 0)
formatValue?
((value: number) => string)

Tooltip value text. Default "N contributions".

(v: number) => `${formatFull(v)} ${v === 1 ? "contribution" : "contributions"}`
formatDate?
((date: string) => string)

Tooltip date text from a `YYYY-MM-DD` string. Default "Oct 3".

(iso: string) => SHORT.format(new Date(`${iso}T00:00:00Z`))
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Gauge Chart

gauge-chart.tsx

Arc meter with threshold bands; the fill and a springy needle swing to the value together.

Chart Gauge Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-gauge

API Reference

value
number
—
min?
number

Default 0.

0
max?
number

Default 100.

100
segments?
GaugeSegment[]

Threshold bands, ascending. The fill takes the color of the band the value sits in.

—
label?
string

Caption under the value. Default: the active segment's label.

—
color?
string

Fill color when there are no segments. Default `--chart-1`.

—
sweep?
number

Arc length in degrees, 180 (semicircle) to 300. Default 240.

240
size?
number

Width in px. Default 260.

260
thickness?
number

Arc thickness in px. Default 16.

16
legend?
boolean

Show the segment legend. Default: when there are segments.

—
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
title
string

Names the meter for assistive tech.

—
className?
string
—

Funnel Chart

funnel-chart.tsx

Horizontal conversion funnel whose stages grow in one by one; hovering a stage reads its step conversion.

Chart Funnel Chart preview width

Install

$ bunx --bun shadcn add @karaui/chart-funnel

API Reference

data
FunnelStage[]

Ordered steps, widest first (visits → signups → purchases…).

—
height?
number

Plot height in px. Default 180.

180
color?
string

Any CSS color; later stages fade toward the surface. Default `--chart-1`.

seriesColor({}, 0)
showConversion?
boolean

Print each step's conversion from the previous one. Default true.

true
formatValue?
((value: number) => string)
(n: number) => FULL.format(n)
title
string

Names the chart for assistive tech and the table view.

—
className?
string
—

Updated