Line chart
A multi-series line chart with a gliding crosshair, legend toggles, and paths that morph between ranges.
A dense time series with an overview strip: drag a window to zoom, resize it by its handles, and read events in place.
npx shadcn@latest add @silicon-ui/brush-chartnpx shadcn@latest add @silicon-ui/brush-chartInstall the dependencies.
npm install motionCopy these files into your project. Shared files are skipped if you already have them.
components/silicon-ui/brush-chart/brush-chart.tsxcomponents/silicon-ui/brush-chart/brush-chart.module.cssInstall the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation
| Prop | Type | Default |
|---|---|---|
data* | BrushChartDatum[] | — |
label*What is measured, such as "Daily active users". Names the chart for assistive technology. | string | — |
unitUnit after each value, such as "users". | string | "" |
formatValue | (value: number) => string | value => grouped.format(value) |
formatTickFormats the value axis. Defaults to a compact number, such as 12K. | (value: number) => string | value => compact.format(value) |
formatDateFormats a date in the tooltip and announcements. | (date: Date) => string | date => fullDate.format(date) |
annotationsEvents drawn as markers on both charts. | BrushChartAnnotation[] | [] |
rangeControlled window as [start, end] epoch milliseconds. A new value glides the window there. | [number, number] | — |
defaultRangeInitial window when uncontrolled. Defaults to the whole series. | [number, number] | — |
onRangeChangeCalled while the window is dragged, resized, stepped, or reset. | (range: [number, number]) => void | — |
minSpanSmallest window in milliseconds. Defaults to seven days. | number | 7 * DAY |
heightMain plot height in pixels. | number | 240 |
overviewHeightOverview strip height in pixels. | number | 52 |
emptyLabel | string | "No data yet" |
ref | Ref<HTMLElement> | — |
className | string | — |