Sparkline
A trend small enough to sit beside a value, as a line, an area or bars, with no axes. The point under the pointer stays bright while the rest steps back, and new values move every point from where it is.
Examples
Stat card
The value above reads the day under the pointer or the keys through onActiveIndexChange, and a new range moves every point from where it is.
Variants
A line, an area or bars with variant, the line and the area with an end dot on their last value.
Table
Sparklines that share one activeIndex light the same day in every row, and the counts beside them read that day.
Tooltip
A ChartTooltip inside reads the hour under the pointer, with its change since the hour before.
Installation
npx shadcn@latest add https://kinoui.com/r/sparkline.json- Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/announce.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/chart-math.tslib/controllable.tslib/number-format.tslib/chart-core.tsxlib/run-progress.tslib/highlight.tscomponents/kino/chart.tsxlib/line-path.tslib/area-fill.tsxlib/placeholder.tslib/chart-line.tsxcomponents/kino/area-chart.tsxcomponents/kino/bar-chart.tsxcomponents/kino/line-chart.tsxcomponents/kino/sparkline.tsx- Packages
@base-ui/reactclass-variance-authorityd3-arrayd3-shape- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
The CLI keeps any of these colours your project already has, such as the chart colours shadcn init writes. To use Kino’s, set them in your global CSS:
:root { --chart-1: oklch(0.62 0.16 250); --chart-2: oklch(0.54 0.18 257); --chart-3: oklch(0.47 0.21 263); --chart-4: oklch(0.4 0.19 268); --chart-5: oklch(0.33 0.15 272);}.dark { --chart-1: oklch(0.82 0.09 245); --chart-2: oklch(0.74 0.13 250); --chart-3: oklch(0.67 0.17 257); --chart-4: oklch(0.61 0.19 263); --chart-5: oklch(0.55 0.2 268);}API reference
Props
Data attributes
CSS variables
Accessibility
- The figure is named by
label. Inside it, the plot is one stop in the tab order: a slider over the points. The arrow keys step, Home and End go to the ends, and each point’s value is read as the slider’s value. - A hidden table holds every value, for screen readers and for copying.
- Loading, an error and new data are announced in a status region.
- Forced colours draw each series in a system colour.
- When the system asks for less motion, points move to their place at once and only fade.