Chart
The parts every chart is built from, such as the grid, the axes, a tooltip that slides between categories, a legend that shows and hides series, reference lines and bands, and Kino’s chart colours.
Examples
Reference lines and bands
ChartReferenceLine marks a value, one worked out from the data such as the average, or a category; ChartReferenceArea shades a range. The value axis reaches far enough to show them.
Patterns
patterns gives each series after the first a pattern over its colour, so the series differ by more than colour. The legend shows and hides them.
Axis titles
An axis takes a label, and side puts it at either edge: here the values sit at the end.
Error
error says the data couldn’t load, and onRetry adds a button that tries again. loading shows a placeholder the bars grow out of.
Installation
npx shadcn@latest add https://kinoui.com/r/chart.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.tsx- Packages
@base-ui/reactclass-variance-authorityd3-array- 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
ChartYAxis
ChartTooltip
ChartReferenceLine
Data attributes
CSS variables
Accessibility
- The chart is a
<figure>named bylabel, with a hidden table of every value. - The plot is one stop in the tab order, a slider over the categories, as the WAI-ARIA slider pattern has it. Escape closes the tooltip and nothing above the chart.
- Loading, an error and new data are announced in a status region that is there before the words arrive.
- The legend’s toggles say whether each series shows. When every series is hidden, a button shows them all again and takes the focus.
- With
patterns, series differ by more than colour, and forced colours draw each series in a system colour.