# Beautiful Charts > React chart components and dashboard blocks for shadcn: 19 chart types and 27 blocks, installed as TypeScript source with the shadcn CLI, on Recharts or Apache ECharts. The Instrument theme is free and MIT. Riso and Clay are paid themes with the same props. Install any item with `npx shadcn@latest add `; the files land in your project and you own them. Data is plain rows; a missing value is `null` and stays a gap. ## Line chart Trends with honest gaps, forecast tails, references and a latest-value readout. Page: https://beautifulcharts.dev/components/line-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/line-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/line-chart-echarts.json ``` ### Usage ```tsx "use client"; import { LineChart } from "@/components/beautiful-charts/themes/instrument/recharts/line-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; // null is a missing reading: the line breaks there instead of dropping to zero. const data = [ { week: "W1", p95: 412 }, { week: "W2", p95: 398 }, { week: "W3", p95: null }, { week: "W4", p95: 377 }, { week: "W5", p95: 351 }, { week: "W6", p95: 342 }, ]; const config = { p95: { label: "p95 latency", color: "var(--chart-1)", marker: "dot" } } satisfies ChartConfig; export function LatencyTrend() { return ( `${ms} ms`} /> ); } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { LineChart } from "@/components/beautiful-charts/themes/instrument/echarts/line-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; // null is a missing reading: the line breaks there instead of dropping to zero. const data = [ { week: "W1", p95: 412 }, { week: "W2", p95: 398 }, { week: "W3", p95: null }, { week: "W4", p95: 377 }, { week: "W5", p95: 351 }, { week: "W6", p95: 342 }, ]; const config = { p95: { label: "p95 latency", color: "var(--chart-1)", marker: "dot" } } satisfies ChartConfig; export function LatencyTrend() { return ( `${ms} ms`} /> ); } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `xKey` | `keyof TDatum & string` | yes | The category or time key on each row, e.g. "month". | | `grid` | `boolean` | no | Draw grid lines behind the plot. On by default. | | `xAxis` | `AxisOptions` | no | Category axis: hide it, format ticks, or add a label. | | `yAxis` | `AxisOptions` | no | Value axis: hide it, format ticks, or add a label. | | `references` | `ReferenceLine[]` | no | Target or threshold lines, fixed or computed from a series (average, median, max, min). | | `series` | `(keyof TDatum & string)[]` | no | Series keys to draw, in order. Defaults to the keys in `config`, then numeric keys in the data. | | `stack` | `StackMode` | no | "none" groups bars side by side and overlays areas. "stacked" stacks them. "percent" splits each row by its absolute total: positive parts stack up from zero, negative parts down, and the parts' sizes add to 100%. | | `orientation` | `"vertical" \| "horizontal"` | no | "vertical" (default) draws columns; "horizontal" draws bars along the value axis. | | `curve` | `Curve` | no | Line and area interpolation. "monotone" (default) never overshoots the data. | | `radius` | `number` | no | Bar corner radius in px. A series' own `radius` in config wins. | | `barGap` | `number` | no | Space between bars in one category, in px. | | `barCategoryGap` | `number` | no | Share of each category left empty around its bars, 0–0.9. | | `maxBarSize` | `number` | no | Widest a bar can get, in px. | | `showValues` | `boolean` | no | Draw each value on its mark. Labels that don't fit are left out; the table and tooltip keep every value. | | `highlight` | `"max" \| "none"` | no | Emphasise the largest category and dim the rest. Ties, and rows with no positive total, emphasise nothing. | | `forecastFrom` | `number` | no | Rows from this index on (inclusive) are a forecast: hatched bars, dashed lines and hatched areas. | | `polarity` | `"up" \| "down"` | no | Whether a rise is good ("up", the default) or bad ("down", e.g. costs or churn). Tints the delta by meaning. | | `brush` | `boolean \| BrushOptions` | no | An overview strip under the plot with a draggable window. Indexes in callbacks stay indexes into `data`. | | `readout` | `boolean` | no | The big number in the header: the total for bars, the latest value for trends. Pass false to hide it (e.g. when a stat row says it better, or when a total means nothing, like a sum of percentages). | | `background` | `"none" \| "rule" \| "dots" \| "grid" \| "crosshair"` | no | A quiet pattern behind the plot, drawn by the theme. | | `backgroundSlot` | `(plot: { x: number; y: number; width: number; height: number }) => ReactNode` | no | Draw your own SVG behind the plot (any pattern or artwork). Receives the plot rectangle in px. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the chart: reference areas, custom labels, anything Recharts accepts. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default, best for large data) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated ECharts option (plain objects merge; arrays and class instances replace), or a function that receives the generated option and returns the final one. See the chart docs. | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `fill` | `FillVariant` | no | Body fill: gradient (default for bars and areas), solid, a pattern, unit blocks or thin bars, or "none". | | `stroke` | `StrokeVariant` | no | Line style for lines and area edges. | | `strokeWidth` | `number` | no | Line width in px. | | `marker` | `MarkerVariant` | no | Marker on each point of a line or area at rest. The active point always gets a ring. | | `glow` | `boolean` | no | A soft glow on this series at rest, not only when it's active. | | `radius` | `number` | no | Bar corner radius for this series, in px. Overrides the chart's `radius`. | | `connectNulls` | `boolean` | no | Join the line across missing values instead of leaving a gap. Off by default: a gap is honest. | | `type` | `"bar" \| "line" \| "area"` | no | For composed charts: how this series is drawn, and which value axis it uses. | | `axis` | `"left" \| "right"` | no | Which value axis the series uses (composed charts). A right axis gets its own scale. | | `stackId` | `string` | no | Bars with the same stack id stack together (composed charts). Defaults to one stack per axis. | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Area chart Overlaid, stacked or 100% areas with gaps kept and forecast tails. Page: https://beautifulcharts.dev/components/area-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/area-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/area-chart-echarts.json ``` ### Usage ```tsx "use client"; import { useState } from "react"; import { AreaChart } from "@/components/beautiful-charts/themes/instrument/recharts/area-chart"; import type { ChartConfig, RangeValue } from "@/components/beautiful-charts/core/contracts"; const data = Array.from({ length: 36 }, (_, i) => ({ month: `M${i + 1}`, desktop: 120 + Math.round(40 * Math.sin(i / 4)) + i * 3, mobile: 80 + Math.round(30 * Math.cos(i / 5)) + i * 2, })); const config = { desktop: { label: "Desktop", color: "var(--chart-1)", fill: "gradient" }, mobile: { label: "Mobile", color: "var(--chart-2)", fill: "gradient" }, } satisfies ChartConfig; // A controlled brush: the range is yours, so a table or filter elsewhere can follow it. export function VisitorsWithBrush() { const [range, setRange] = useState({ startIndex: 24, endIndex: 35 }); return ( ); } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { useState } from "react"; import { AreaChart } from "@/components/beautiful-charts/themes/instrument/echarts/area-chart"; import type { ChartConfig, RangeValue } from "@/components/beautiful-charts/core/contracts"; const data = Array.from({ length: 36 }, (_, i) => ({ month: `M${i + 1}`, desktop: 120 + Math.round(40 * Math.sin(i / 4)) + i * 3, mobile: 80 + Math.round(30 * Math.cos(i / 5)) + i * 2, })); const config = { desktop: { label: "Desktop", color: "var(--chart-1)", fill: "gradient" }, mobile: { label: "Mobile", color: "var(--chart-2)", fill: "gradient" }, } satisfies ChartConfig; // A controlled brush: the range is yours, so a table or filter elsewhere can follow it. export function VisitorsWithBrush() { const [range, setRange] = useState({ startIndex: 24, endIndex: 35 }); return ( ); } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `xKey` | `keyof TDatum & string` | yes | The category or time key on each row, e.g. "month". | | `grid` | `boolean` | no | Draw grid lines behind the plot. On by default. | | `xAxis` | `AxisOptions` | no | Category axis: hide it, format ticks, or add a label. | | `yAxis` | `AxisOptions` | no | Value axis: hide it, format ticks, or add a label. | | `references` | `ReferenceLine[]` | no | Target or threshold lines, fixed or computed from a series (average, median, max, min). | | `series` | `(keyof TDatum & string)[]` | no | Series keys to draw, in order. Defaults to the keys in `config`, then numeric keys in the data. | | `stack` | `StackMode` | no | "none" groups bars side by side and overlays areas. "stacked" stacks them. "percent" splits each row by its absolute total: positive parts stack up from zero, negative parts down, and the parts' sizes add to 100%. | | `orientation` | `"vertical" \| "horizontal"` | no | "vertical" (default) draws columns; "horizontal" draws bars along the value axis. | | `curve` | `Curve` | no | Line and area interpolation. "monotone" (default) never overshoots the data. | | `radius` | `number` | no | Bar corner radius in px. A series' own `radius` in config wins. | | `barGap` | `number` | no | Space between bars in one category, in px. | | `barCategoryGap` | `number` | no | Share of each category left empty around its bars, 0–0.9. | | `maxBarSize` | `number` | no | Widest a bar can get, in px. | | `showValues` | `boolean` | no | Draw each value on its mark. Labels that don't fit are left out; the table and tooltip keep every value. | | `highlight` | `"max" \| "none"` | no | Emphasise the largest category and dim the rest. Ties, and rows with no positive total, emphasise nothing. | | `forecastFrom` | `number` | no | Rows from this index on (inclusive) are a forecast: hatched bars, dashed lines and hatched areas. | | `polarity` | `"up" \| "down"` | no | Whether a rise is good ("up", the default) or bad ("down", e.g. costs or churn). Tints the delta by meaning. | | `brush` | `boolean \| BrushOptions` | no | An overview strip under the plot with a draggable window. Indexes in callbacks stay indexes into `data`. | | `readout` | `boolean` | no | The big number in the header: the total for bars, the latest value for trends. Pass false to hide it (e.g. when a stat row says it better, or when a total means nothing, like a sum of percentages). | | `background` | `"none" \| "rule" \| "dots" \| "grid" \| "crosshair"` | no | A quiet pattern behind the plot, drawn by the theme. | | `backgroundSlot` | `(plot: { x: number; y: number; width: number; height: number }) => ReactNode` | no | Draw your own SVG behind the plot (any pattern or artwork). Receives the plot rectangle in px. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the chart: reference areas, custom labels, anything Recharts accepts. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default, best for large data) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated ECharts option (plain objects merge; arrays and class instances replace), or a function that receives the generated option and returns the final one. See the chart docs. | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `fill` | `FillVariant` | no | Body fill: gradient (default for bars and areas), solid, a pattern, unit blocks or thin bars, or "none". | | `stroke` | `StrokeVariant` | no | Line style for lines and area edges. | | `strokeWidth` | `number` | no | Line width in px. | | `marker` | `MarkerVariant` | no | Marker on each point of a line or area at rest. The active point always gets a ring. | | `glow` | `boolean` | no | A soft glow on this series at rest, not only when it's active. | | `radius` | `number` | no | Bar corner radius for this series, in px. Overrides the chart's `radius`. | | `connectNulls` | `boolean` | no | Join the line across missing values instead of leaving a gap. Off by default: a gap is honest. | | `type` | `"bar" \| "line" \| "area"` | no | For composed charts: how this series is drawn, and which value axis it uses. | | `axis` | `"left" \| "right"` | no | Which value axis the series uses (composed charts). A right axis gets its own scale. | | `stackId` | `string` | no | Bars with the same stack id stack together (composed charts). Defaults to one stack per axis. | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Composed chart Bars, lines and areas together, with a second value axis. Page: https://beautifulcharts.dev/components/composed-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/composed-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/composed-chart-echarts.json ``` ### Usage ```tsx "use client"; import { ComposedChart } from "@/components/beautiful-charts/themes/instrument/recharts/composed-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { quarter: "Q1", revenue: 420, margin: 0.31 }, { quarter: "Q2", revenue: 510, margin: 0.34 }, { quarter: "Q3", revenue: 480, margin: 0.29 }, { quarter: "Q4", revenue: 620, margin: 0.36 }, ]; // Bars on the left axis, a line on the right axis with its own formatter. const config = { revenue: { label: "Revenue", type: "bar", axis: "left", color: "var(--chart-1)", format: (v: number) => `$${v}k` }, margin: { label: "Margin", type: "line", axis: "right", color: "var(--chart-2)", format: (v: number) => `${Math.round(v * 100)}%` }, } satisfies ChartConfig; export function RevenueAndMargin() { return ; } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { ComposedChart } from "@/components/beautiful-charts/themes/instrument/echarts/composed-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { quarter: "Q1", revenue: 420, margin: 0.31 }, { quarter: "Q2", revenue: 510, margin: 0.34 }, { quarter: "Q3", revenue: 480, margin: 0.29 }, { quarter: "Q4", revenue: 620, margin: 0.36 }, ]; // Bars on the left axis, a line on the right axis with its own formatter. const config = { revenue: { label: "Revenue", type: "bar", axis: "left", color: "var(--chart-1)", format: (v: number) => `$${v}k` }, margin: { label: "Margin", type: "line", axis: "right", color: "var(--chart-2)", format: (v: number) => `${Math.round(v * 100)}%` }, } satisfies ChartConfig; export function RevenueAndMargin() { return ; } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `xKey` | `keyof TDatum & string` | yes | The category or time key on each row, e.g. "month". | | `grid` | `boolean` | no | Draw grid lines behind the plot. On by default. | | `xAxis` | `AxisOptions` | no | Category axis: hide it, format ticks, or add a label. | | `yAxis` | `AxisOptions` | no | Value axis: hide it, format ticks, or add a label. | | `references` | `ReferenceLine[]` | no | Target or threshold lines, fixed or computed from a series (average, median, max, min). | | `series` | `(keyof TDatum & string)[]` | no | Series keys to draw, in order. Defaults to the keys in `config`, then numeric keys in the data. | | `stack` | `StackMode` | no | "none" groups bars side by side and overlays areas. "stacked" stacks them. "percent" splits each row by its absolute total: positive parts stack up from zero, negative parts down, and the parts' sizes add to 100%. | | `orientation` | `"vertical" \| "horizontal"` | no | "vertical" (default) draws columns; "horizontal" draws bars along the value axis. | | `curve` | `Curve` | no | Line and area interpolation. "monotone" (default) never overshoots the data. | | `radius` | `number` | no | Bar corner radius in px. A series' own `radius` in config wins. | | `barGap` | `number` | no | Space between bars in one category, in px. | | `barCategoryGap` | `number` | no | Share of each category left empty around its bars, 0–0.9. | | `maxBarSize` | `number` | no | Widest a bar can get, in px. | | `showValues` | `boolean` | no | Draw each value on its mark. Labels that don't fit are left out; the table and tooltip keep every value. | | `highlight` | `"max" \| "none"` | no | Emphasise the largest category and dim the rest. Ties, and rows with no positive total, emphasise nothing. | | `forecastFrom` | `number` | no | Rows from this index on (inclusive) are a forecast: hatched bars, dashed lines and hatched areas. | | `polarity` | `"up" \| "down"` | no | Whether a rise is good ("up", the default) or bad ("down", e.g. costs or churn). Tints the delta by meaning. | | `brush` | `boolean \| BrushOptions` | no | An overview strip under the plot with a draggable window. Indexes in callbacks stay indexes into `data`. | | `readout` | `boolean` | no | The big number in the header: the total for bars, the latest value for trends. Pass false to hide it (e.g. when a stat row says it better, or when a total means nothing, like a sum of percentages). | | `background` | `"none" \| "rule" \| "dots" \| "grid" \| "crosshair"` | no | A quiet pattern behind the plot, drawn by the theme. | | `backgroundSlot` | `(plot: { x: number; y: number; width: number; height: number }) => ReactNode` | no | Draw your own SVG behind the plot (any pattern or artwork). Receives the plot rectangle in px. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the chart: reference areas, custom labels, anything Recharts accepts. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default, best for large data) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated ECharts option (plain objects merge; arrays and class instances replace), or a function that receives the generated option and returns the final one. See the chart docs. | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `fill` | `FillVariant` | no | Body fill: gradient (default for bars and areas), solid, a pattern, unit blocks or thin bars, or "none". | | `stroke` | `StrokeVariant` | no | Line style for lines and area edges. | | `strokeWidth` | `number` | no | Line width in px. | | `marker` | `MarkerVariant` | no | Marker on each point of a line or area at rest. The active point always gets a ring. | | `glow` | `boolean` | no | A soft glow on this series at rest, not only when it's active. | | `radius` | `number` | no | Bar corner radius for this series, in px. Overrides the chart's `radius`. | | `connectNulls` | `boolean` | no | Join the line across missing values instead of leaving a gap. Off by default: a gap is honest. | | `type` | `"bar" \| "line" \| "area"` | no | For composed charts: how this series is drawn, and which value axis it uses. | | `axis` | `"left" \| "right"` | no | Which value axis the series uses (composed charts). A right axis gets its own scale. | | `stackId` | `string` | no | Bars with the same stack id stack together (composed charts). Defaults to one stack per axis. | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Spark chart A trend for a table cell or a KPI row: line, area or bar, with gaps kept and the latest value marked. Plain SVG: no chart engine. Page: https://beautifulcharts.dev/components/spark-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/spark-chart.json ``` ### Usage ```tsx "use client"; import { SparkChart } from "@/components/beautiful-charts/themes/instrument/spark-chart"; const accounts = [ { name: "Account 01", trend: [{ week: "W36", seats: 12 }, { week: "W37", seats: 14 }, { week: "W38", seats: null }, { week: "W39", seats: 17 }, { week: "W40", seats: 19 }] }, { name: "Account 02", trend: [{ week: "W36", seats: 30 }, { week: "W37", seats: 28 }, { week: "W38", seats: 26 }, { week: "W39", seats: 27 }, { week: "W40", seats: 22 }] }, ]; // One spark per row. The missing week stays a gap, and each spark is read as one sentence. export function SeatsTable() { return ( {accounts.map((account) => ( ))}
{account.name}
); } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `data` | `TDatum[]` | yes | Your rows, oldest first. | | `valueKey` | `keyof TDatum & string` | yes | The number to draw, on each row. | | `xKey` | `keyof TDatum & string` | no | A label for each row, e.g. a month. Used in the summary; without it, points are counted. | | `label` | `string` | no | What the number is, e.g. "Sign-ups". Names the spark for screen readers. | | `polarity` | `"up" \| "down"` | no | "up" when a rise is good (default), "down" for costs, churn, latency. | | `valueFormatter` | `(value: number) => string` | no | Formats the numbers in the summary. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `type` | `"line" \| "area" \| "bar"` | no | "line" (default), "area" or "bar". | | `height` | `number` | no | Height in px (default 32). The width fills its container. | | `color` | `string` | no | The mark colour; defaults to the theme's first palette colour. Any CSS colour or var(). | | `className` | `string` | no | Classes on the spark, e.g. a fixed width such as "w-28". | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Screen readers get one summary sentence. ## Bar chart Grouped, stacked or 100%, vertical or horizontal, with a measured callout and a computed takeaway. Page: https://beautifulcharts.dev/components/bar-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/bar-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/bar-chart-echarts.json ``` ### Usage ```tsx "use client"; import { BarChart } from "@/components/beautiful-charts/themes/instrument/recharts/bar-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { month: "Jan", signups: 186, trials: 80 }, { month: "Feb", signups: 305, trials: 200 }, { month: "Mar", signups: 237, trials: 120 }, { month: "Apr", signups: 73, trials: 190 }, { month: "May", signups: 209, trials: 130 }, { month: "Jun", signups: 214, trials: 140 }, ]; const config = { signups: { label: "Sign-ups", color: "var(--chart-1)" }, trials: { label: "Trials", color: "var(--chart-2)" }, } satisfies ChartConfig; export function SignupsByMonth() { return ( value.toLocaleString("en-US")} onSelectedChange={(selection) => console.log(selection?.datum.month, selection?.seriesKey)} /> ); } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { BarChart } from "@/components/beautiful-charts/themes/instrument/echarts/bar-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { month: "Jan", signups: 186, trials: 80 }, { month: "Feb", signups: 305, trials: 200 }, { month: "Mar", signups: 237, trials: 120 }, { month: "Apr", signups: 73, trials: 190 }, { month: "May", signups: 209, trials: 130 }, { month: "Jun", signups: 214, trials: 140 }, ]; const config = { signups: { label: "Sign-ups", color: "var(--chart-1)" }, trials: { label: "Trials", color: "var(--chart-2)" }, } satisfies ChartConfig; export function SignupsByMonth() { return ( value.toLocaleString("en-US")} onSelectedChange={(selection) => console.log(selection?.datum.month, selection?.seriesKey)} /> ); } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `xKey` | `keyof TDatum & string` | yes | The category or time key on each row, e.g. "month". | | `grid` | `boolean` | no | Draw grid lines behind the plot. On by default. | | `xAxis` | `AxisOptions` | no | Category axis: hide it, format ticks, or add a label. | | `yAxis` | `AxisOptions` | no | Value axis: hide it, format ticks, or add a label. | | `references` | `ReferenceLine[]` | no | Target or threshold lines, fixed or computed from a series (average, median, max, min). | | `series` | `(keyof TDatum & string)[]` | no | Series keys to draw, in order. Defaults to the keys in `config`, then numeric keys in the data. | | `stack` | `StackMode` | no | "none" groups bars side by side and overlays areas. "stacked" stacks them. "percent" splits each row by its absolute total: positive parts stack up from zero, negative parts down, and the parts' sizes add to 100%. | | `orientation` | `"vertical" \| "horizontal"` | no | "vertical" (default) draws columns; "horizontal" draws bars along the value axis. | | `curve` | `Curve` | no | Line and area interpolation. "monotone" (default) never overshoots the data. | | `radius` | `number` | no | Bar corner radius in px. A series' own `radius` in config wins. | | `barGap` | `number` | no | Space between bars in one category, in px. | | `barCategoryGap` | `number` | no | Share of each category left empty around its bars, 0–0.9. | | `maxBarSize` | `number` | no | Widest a bar can get, in px. | | `showValues` | `boolean` | no | Draw each value on its mark. Labels that don't fit are left out; the table and tooltip keep every value. | | `highlight` | `"max" \| "none"` | no | Emphasise the largest category and dim the rest. Ties, and rows with no positive total, emphasise nothing. | | `forecastFrom` | `number` | no | Rows from this index on (inclusive) are a forecast: hatched bars, dashed lines and hatched areas. | | `polarity` | `"up" \| "down"` | no | Whether a rise is good ("up", the default) or bad ("down", e.g. costs or churn). Tints the delta by meaning. | | `brush` | `boolean \| BrushOptions` | no | An overview strip under the plot with a draggable window. Indexes in callbacks stay indexes into `data`. | | `readout` | `boolean` | no | The big number in the header: the total for bars, the latest value for trends. Pass false to hide it (e.g. when a stat row says it better, or when a total means nothing, like a sum of percentages). | | `background` | `"none" \| "rule" \| "dots" \| "grid" \| "crosshair"` | no | A quiet pattern behind the plot, drawn by the theme. | | `backgroundSlot` | `(plot: { x: number; y: number; width: number; height: number }) => ReactNode` | no | Draw your own SVG behind the plot (any pattern or artwork). Receives the plot rectangle in px. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the chart: reference areas, custom labels, anything Recharts accepts. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default, best for large data) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated ECharts option (plain objects merge; arrays and class instances replace), or a function that receives the generated option and returns the final one. See the chart docs. | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `fill` | `FillVariant` | no | Body fill: gradient (default for bars and areas), solid, a pattern, unit blocks or thin bars, or "none". | | `stroke` | `StrokeVariant` | no | Line style for lines and area edges. | | `strokeWidth` | `number` | no | Line width in px. | | `marker` | `MarkerVariant` | no | Marker on each point of a line or area at rest. The active point always gets a ring. | | `glow` | `boolean` | no | A soft glow on this series at rest, not only when it's active. | | `radius` | `number` | no | Bar corner radius for this series, in px. Overrides the chart's `radius`. | | `connectNulls` | `boolean` | no | Join the line across missing values instead of leaving a gap. Off by default: a gap is honest. | | `type` | `"bar" \| "line" \| "area"` | no | For composed charts: how this series is drawn, and which value axis it uses. | | `axis` | `"left" \| "right"` | no | Which value axis the series uses (composed charts). A right axis gets its own scale. | | `stackId` | `string` | no | Bars with the same stack id stack together (composed charts). Defaults to one stack per axis. | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Radar chart Profiles across axes with per-axis ranges, honest gaps and an optional benchmark. Page: https://beautifulcharts.dev/components/radar-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/radar-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/radar-chart-echarts.json ``` ### Usage ```tsx "use client"; import { RadarChart } from "@/components/beautiful-charts/themes/instrument/recharts/radar-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { skill: "Speed", us: 82, market: 64 }, { skill: "Reliability", us: 90, market: 71 }, { skill: "Support", us: 58, market: 66 }, { skill: "Price", us: 70, market: 75 }, { skill: "Docs", us: 88, market: 52 }, ]; const config = { us: { label: "Our product", color: "var(--chart-1)" }, market: { label: "Market median" }, } satisfies ChartConfig; // The benchmark series is drawn as a quiet outline behind the others. export function ProductProfile() { return ; } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { RadarChart } from "@/components/beautiful-charts/themes/instrument/echarts/radar-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { skill: "Speed", us: 82, market: 64 }, { skill: "Reliability", us: 90, market: 71 }, { skill: "Support", us: 58, market: 66 }, { skill: "Price", us: 70, market: 75 }, { skill: "Docs", us: 88, market: 52 }, ]; const config = { us: { label: "Our product", color: "var(--chart-1)" }, market: { label: "Market median" }, } satisfies ChartConfig; // The benchmark series is drawn as a quiet outline behind the others. export function ProductProfile() { return ; } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `axisKey` | `keyof TDatum & string` | yes | The field naming each axis, e.g. "skill". | | `series` | `(keyof TDatum & string)[]` | no | Profiles to draw, in order. Defaults to the keys in `config`, then numeric fields. | | `axes` | `Record` | no | Per-axis ranges by axis name. Axes not listed share a range computed from all values (from 0). | | `benchmark` | `keyof TDatum & string` | no | A profile drawn as a dashed reference, without fill, that the takeaway compares against. | | `grid` | `boolean` | no | Draw the grid rings and spokes. On by default. | | `gridShape` | `"polygon" \| "circle"` | no | Polygon (default) or circular grid rings. | | `filled` | `boolean` | no | Fill each profile, or draw outlines only. Per-profile `fill: "none"` in config also works. | | `dots` | `boolean` | no | Draw a dot on each vertex. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the same RadarChart, which receives your original rows. A native uses Recharts' single radius scale, not Instrument's per-axis ranges; use it for axes on one shared scale. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated option, or `(generated) => option`. Profiles are one custom series (id "profiles", one item per profile). | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `fill` | `FillVariant` | no | Body fill: gradient (default for bars and areas), solid, a pattern, unit blocks or thin bars, or "none". | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Scatter chart Points by two numbers, bubbles sized by area, groups, log axes, quadrants and trend lines; rows it can't place are counted. Page: https://beautifulcharts.dev/components/scatter-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/scatter-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/scatter-chart-echarts.json ``` ### Usage ```tsx "use client"; import { ScatterChart } from "@/components/beautiful-charts/themes/instrument/recharts/scatter-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { team: "Atlas", cycle: 3.1, bugs: 4, size: 12 }, { team: "Beacon", cycle: 2.2, bugs: 2, size: 7 }, { team: "Cobalt", cycle: 5.4, bugs: 11, size: 20 }, { team: "Drift", cycle: 2.8, bugs: 3, size: 9 }, { team: "Ember", cycle: 4.0, bugs: 7, size: 15 }, { team: "Fjord", cycle: null, bugs: 1, size: 5 }, // not drawn, and counted ]; // Entries for the fields set labels and formats; bubbles are sized by area, so twice the people looks twice as big. const config = { cycle: { label: "Cycle time", format: (days: number) => `${days} d` }, bugs: { label: "Bugs" }, size: { label: "People" }, } satisfies ChartConfig; export function CycleTimeAndBugs() { return ; } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { ScatterChart } from "@/components/beautiful-charts/themes/instrument/echarts/scatter-chart"; import type { ChartConfig } from "@/components/beautiful-charts/core/contracts"; const data = [ { team: "Atlas", cycle: 3.1, bugs: 4, size: 12 }, { team: "Beacon", cycle: 2.2, bugs: 2, size: 7 }, { team: "Cobalt", cycle: 5.4, bugs: 11, size: 20 }, { team: "Drift", cycle: 2.8, bugs: 3, size: 9 }, { team: "Ember", cycle: 4.0, bugs: 7, size: 15 }, { team: "Fjord", cycle: null, bugs: 1, size: 5 }, // not drawn, and counted ]; // Entries for the fields set labels and formats; bubbles are sized by area, so twice the people looks twice as big. const config = { cycle: { label: "Cycle time", format: (days: number) => `${days} d` }, bugs: { label: "Bugs" }, size: { label: "People" }, } satisfies ChartConfig; export function CycleTimeAndBugs() { return ; } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `xKey` | `keyof TDatum & string` | yes | The field for the horizontal position (a number). | | `yKey` | `keyof TDatum & string` | yes | The field for the vertical position (a number). | | `sizeKey` | `keyof TDatum & string` | no | A field that sizes each point by area, making a bubble chart. | | `groupKey` | `keyof TDatum & string` | no | A field that sorts points into coloured groups. Group names are the keys of `config`. | | `nameKey` | `keyof TDatum & string` | no | A field naming each point, for tooltips, the table and labels. | | `labelPoints` | `string[] \| "top"` | no | Label these points on the chart (by name), or the largest few ("top"). | | `xScale` | `"linear" \| "log"` | no | "linear" (default) or "log" (powers of ten). | | `yScale` | `"linear" \| "log"` | no | "linear" (default) or "log" (powers of ten). | | `trend` | `boolean` | no | Draw a least-squares trend line per group (or for all points without groups). | | `quadrants` | `{ x: number; y: number; labels?: [string, string, string, string] }` | no | Split the plot into quadrants at these values, with optional labels (top-left, top-right, bottom-left, bottom-right). | | `maxRadius` | `number` | no | Largest bubble radius in px (default 22). | | `radius` | `number` | no | Point radius when there's no `sizeKey`, in px (default 4.5). | | `grid` | `boolean` | no | Draw grid lines behind the plot. On by default. | | `xAxis` | `AxisOptions` | no | Horizontal axis: hide it, format ticks, or add a label (defaults to the x field's label). | | `yAxis` | `AxisOptions` | no | Vertical axis: hide it, format ticks, or add a label (defaults to the y field's label). | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `selectedSeries` | `string \| null` | no | Controlled series selection: this series stays lit and the others dim. | | `defaultSelectedSeries` | `string \| null` | no | Initial series selection when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the same ScatterChart, which receives your original rows. | #### ECharts build only | Prop | Type | Required | Description | |---|---|---|---| | `renderer` | `EChartsRenderer` | no | "canvas" (default, best for many points) or "svg". | | `option` | `OptionOverride` | no | Deep-merged over the generated option, or `(generated) => option`. Points are custom series "points" (one item per point); trend lines are "trends". | ### Events | Prop | Type | Required | Description | |---|---|---|---| | `onSelectedChange` | `(selection: Selection \| null) => void` | no | Called when a row is selected or cleared, by pointer, keyboard or the data table. | | `onSelectedSeriesChange` | `(key: string \| null) => void` | no | Called when the selected series changes (legend "select" action, or a click on a series). | | `onHiddenChange` | `(hidden: string[]) => void` | no | Called when the legend hides or shows a series. | | `onActiveChange` | `(index: number \| null) => void` | no | Called as the hovered or focused row changes, or null when it leaves. | | `onReady` | `(chart: EChartsType) => void` | no | ECharts build only. Called once with the ECharts instance, e.g. to add event listeners. | ### Series config `config` maps each data key to how it's shown: | Prop | Type | Required | Description | |---|---|---|---| | `label` | `ReactNode` | no | Name shown in the legend, tooltip and table. Defaults to the key, humanised. | | `ariaLabel` | `string` | no | Plain text for tables, summaries and announcements when `label` is not a string. | | `icon` | `ComponentType<{ className?: string }>` | no | An icon component (e.g. from lucide-react) shown in place of the swatch in the legend and tooltip. | | `format` | `(value: number) => string` | no | Formats this series' values everywhere: tooltip, legend, table, readout. | | `color` | `ColorValue` | no | One colour: any CSS colour or var(--chart-1), or `{ light, dark }`. | | `theme` | `never` | no | shadcn's per-theme colours, `{ light, dark }`. | | `colors` | `never` | no | Gradient stops from base to value end, per theme. The last stop is the series' single colour. | Missing values are `null` and stay gaps; nothing is filled in or counted as zero. Plots are keyboard reachable (arrows, Home, End, Enter to pin, Escape to clear) and announce what's under the cursor. ## Bar list Named values ranked largest first, each with a bar sized to the largest; a real list, with optional links. Plain HTML: no chart engine. Page: https://beautifulcharts.dev/components/bar-list ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/bar-list.json ``` ### Usage ```tsx "use client"; import { BarList } from "@/components/beautiful-charts/themes/instrument/bar-list"; const sources = [ { source: "Search", visits: 4820, href: "/analytics/search" }, { source: "Direct", visits: 3110, href: "/analytics/direct" }, { source: "Newsletter", visits: 1290, href: "/analytics/newsletter" }, { source: "Partners", visits: null, href: "/analytics/partners" }, ]; // Ranked largest first. The row with no value is listed with a dash and no bar, never as zero. export function TrafficSources() { return ; } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `data` | `TDatum[]` | yes | Your rows. | | `nameKey` | `keyof TDatum & string` | yes | The row's name. | | `valueKey` | `keyof TDatum & string` | yes | The row's number. | | `hrefKey` | `keyof TDatum & string` | no | Optional link for each row: the name becomes a link. | | `sort` | `"descending" \| "ascending" \| "none"` | no | "descending" (default), "ascending", or "none" to keep your order. Missing values always go last. | | `label` | `string` | no | What the list is, e.g. "Top pages". Names it for screen readers. | | `showShare` | `boolean` | no | Show each row's share of the total next to its value. | | `valueFormatter` | `(value: number) => string` | no | Formats the values. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `color` | `string` | no | The bar colour; defaults to the theme's first palette colour. Any CSS colour or var(). | | `className` | `string` | no | Classes on the list. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | A missing value is a dash with no bar, never zero, and sorts last; a negative one is listed but not drawn. It's a real list: screen readers read every row, and a row with a link is an ordinary link. ## Donut chart Donut or pie with Other grouping, honest exclusions, labels inside or outside and a centre readout. Page: https://beautifulcharts.dev/components/donut-chart ### Install ```bash npx shadcn@latest add https://beautifulcharts.dev/r/donut-chart.json ``` Apache ECharts build, same props: ```bash npx shadcn@latest add https://beautifulcharts.dev/r/donut-chart-echarts.json ``` ### Usage ```tsx "use client"; import { DonutChart } from "@/components/beautiful-charts/themes/instrument/recharts/donut-chart"; const data = [ { channel: "Organic", visits: 4120 }, { channel: "Referral", visits: 1860 }, { channel: "Paid search", visits: 1340 }, { channel: "Social", visits: 720 }, { channel: "Email", visits: 410 }, ]; // Segments under 6% are grouped into one "Other" segment; its tooltip lists every member. export function TrafficSources() { return ( ); } ``` With the ECharts build, import it from its own file: ```tsx "use client"; import { DonutChart } from "@/components/beautiful-charts/themes/instrument/echarts/donut-chart"; const data = [ { channel: "Organic", visits: 4120 }, { channel: "Referral", visits: 1860 }, { channel: "Paid search", visits: 1340 }, { channel: "Social", visits: 720 }, { channel: "Email", visits: 410 }, ]; // Segments under 6% are grouped into one "Other" segment; its tooltip lists every member. export function TrafficSources() { return ( ); } ``` ### Props | Prop | Type | Required | Description | |---|---|---|---| | `nameKey` | `keyof TDatum & string` | yes | The field that names each segment, e.g. "channel". | | `valueKey` | `keyof TDatum & string` | yes | The field that holds each segment's value, e.g. "revenue". | | `innerRadius` | `number` | no | Hole size as a share of the radius, 0–0.9. 0 draws a pie. | | `padAngle` | `number` | no | Gap between segments, in degrees. | | `cornerRadius` | `number` | no | Corner radius of each segment, in px. | | `startAngle` | `number` | no | Where the ring starts and ends, in degrees clockwise from 12 o'clock. A half ring is -90 to 90. | | `endAngle` | `number` | no | Where the ring ends, in degrees clockwise from 12 o'clock. | | `groupBelow` | `number` | no | Group segments smaller than this share (0–1) into one "Other" segment. Members stay in the table and tooltip. | | `maxSegments` | `number` | no | Keep at most this many segments; the rest go into "Other". | | `otherLabel` | `string` | no | Name of the grouped segment. Defaults to "Other". | | `labels` | `"none" \| "inside" \| "outside"` | no | Segment labels: none, inside the ring, or outside with leader lines. | | `labelContent` | `"value" \| "share" \| "both"` | no | What labels and the legend show: the value, the share, or both. | | `center` | `false \| { label?: string }` | no | The centre readout. Defaults to the shown total, or the selected segment. `false` leaves the hole empty. | | `data` | `TDatum[]` | yes | Your rows, as they are. Missing values (null, undefined, NaN) stay missing and are never drawn as zero. | | `locale` | `string` | no | BCP 47 locale. Defaults to "en-US" so server and client render the same text. | | `timeZone` | `string` | no | IANA time zone for dates. Defaults to "UTC" so server and client agree. | | `config` | `ChartConfig` | no | Per-series label, colour, icon, format and style, keyed by series key. shadcn ChartConfig works as it is. | | `eyebrow` | `ReactNode` | no | Small label above the title. | | `title` | `ReactNode` | no | Card title. A string also names the chart for screen readers. | | `description` | `ReactNode` | no | A line under the title. | | `takeaway` | `ReactNode \| ((summary: string) => ReactNode) \| false` | no | The sentence under the title. Computed from the data by default; pass text, a function of the computed sentence, or false to hide it. | | `ariaDescription` | `string` | no | Accessible summary for screen readers. Computed from the data by default. | | `motion` | `MotionPreference` | no | "full" (default), "subtle" or "off". Reduced-motion settings always win. | | `motionOptions` | `MotionOptions` | no | When the entrance plays. | | `sound` | `boolean` | no | Sound cues on hover, scrub and select. Plays only if the visitor has also turned sound on for the page. | | `density` | `Density` | no | "comfortable" (default) or "compact" for dashboards. | | `legend` | `LegendOptions \| false` | no | Legend position, alignment, shape and click action, or false to hide it. | | `tooltip` | `TooltipOptions \| false` | no | Tooltip position, indicator, cursor and custom content, or false to turn it off. | | `valueFormatter` | `(value: number) => string` | no | Values formatted for display. Series formatters in config win. | | `loading` | `boolean` | no | Show the loading state. Over existing data, the old marks stay dimmed instead of vanishing. | | `error` | `string \| null` | no | An error message. Shows the error state in place of the plot. | | `emptyState` | `ReactNode` | no | Shown instead of the plot when there is no data. | | `loadingState` | `ReactNode` | no | Shown while `loading` is true and there is no data yet. | | `errorState` | `ReactNode` | no | Shown when `error` is set. | | `selected` | `number \| null` | no | Controlled and uncontrolled interaction state. Point selection (`selected`) pins one row by its index in `data`. Series selection (`selectedSeries`) picks one series and dims the others. They are separate: picking a row doesn't pick a series. | | `defaultSelected` | `number \| null` | no | Initial selected row when uncontrolled. | | `hidden` | `string[]` | no | Controlled hidden series keys. | | `defaultHidden` | `string[]` | no | Series hidden at first when uncontrolled. | | `activeIndex` | `number \| null` | no | Controlled hover or focus index, for syncing several charts on one cursor. | | `palette` | `"theme" \| "shadcn"` | no | Series colours: "theme" (default) uses the theme's designed palette; "shadcn" uses your --chart-1..5. --bc-series-N always wins. You can also opt a whole section in with the class bc-use-shadcn-colors. | | `table` | `boolean` | no | Show the "Show data table" disclosure. On by default. | | `stats` | `ChartStat[]` | no | A row of figures under the title, for dashboard cards and blocks. | | `footer` | `ReactNode` | no | A line or action at the bottom of the card, e.g. a source note or a link. | | `className` | `string` | no | Classes on the card, for spacing and layout. | | `height` | `number` | no | Height of the plot area in px. The frame sizes around it. | #### Recharts build only | Prop | Type | Required | Description | |---|---|---|---| | `children` | `ReactNode` | no | Recharts children render inside the same PieChart, which receives your original rows: add a native ring, a