Bump chart
Ranks over time, one line per item, crossing where one overtakes another. Names and ranks sit at both ends, the hovered line stays bright end to end, and new ranks move every line from where it is.
Examples
Ranked by amount
rankBy ranks each week’s amounts, the highest first, and the tooltip gives each amount. Another measure moves every line to its new ranks, and the line under the pointer stays bright while the rest step back.
Given ranks
Ranks as the data has them, 1 the top. The other apps in a grey color let one line lead.
Gaps
An item with no rank in a period, out of the top five here, leaves a gap, and a name shows only at an end it reaches.
Lowest first
rankBy='lowest' ranks the smallest amount first, such as the fastest time. The legend hides an item, and the rest keep their rows.
Installation
npx shadcn@latest add https://kinoui.com/r/bump-chart.json- Files
lib/dates.tslib/chart-math.tslib/chart-scale.tslib/chart-frame.tslib/line-path.tslib/chart-line-marks.tslib/refs.tslib/reduce-motion.tslib/resize.tslib/live.tsxlib/chart-live.tslib/chart-live-clock.tsxlib/scroll.tslib/swap.tsxlib/popup.tslib/glide.tsxlib/keys.tsxcomponents/kino/kbd.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/number-format.tslib/roll.tsxlib/run-progress.tscomponents/kino/animated-number.tsxlib/announce.tscomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/controllable.tslib/chart-root.tsxlib/chart-state.tslib/chart-agent.tslib/chart-base.tsxlib/chart-cartesian-reader.tslib/chart-cartesian.tsxlib/chart-list.tsxlib/chart-list-reader.tslib/chart-tree-reader.tslib/chart-flow-reader.tslib/chart-grid-reader.tslib/highlight.tscomponents/kino/chart.tsxlib/area-fill.tsxlib/placeholder.tslib/chart-line.tsxcomponents/kino/bump-chart.tsx- Packages
@ui-sdk/core@ui-sdk/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.42 0.1 248); --chart-2: oklch(0.53 0.12 222); --chart-3: oklch(0.6 0.11 185); --chart-4: oklch(0.65 0.17 132); --chart-5: oklch(0.72 0.154 106.7); --chart-accent: oklch(0.795 0.171 71.2);}.dark { --chart-1: oklch(0.6 0.15 255); --chart-2: oklch(0.7 0.13 222); --chart-3: oklch(0.79 0.13 185); --chart-4: oklch(0.82 0.15 128); --chart-5: oklch(0.72 0.154 106.7); --chart-accent: oklch(0.795 0.171 71.2);}API reference
BumpChart
The chart: a <figure> named by label, holding the chart’s parts. Rank 1 is the top row, and each rank has a row at least --bump-chart-row tall, so the chart is as tall as its ranks unless you give it a taller height. Other props go to the figure.
Bump
One item’s line, in its colour, through its rank in each period, with an S from one rank to the next. Other props go to its layer.
BumpNames
Each item’s name and rank at one end of its line, in the first period or the last. Pointing at a name brings its line forward. Other props go to its column.
ChartGrid
Dashed lines across the plot at the value axis’s ticks, and on a chart whose x is a value too, such as the Scatter chart, along it at the x axis’s ticks. They slide when the range changes.
ChartXAxis
The axis under the plot: categories for upright bars, values for lying ones, x values on a chart whose x is a value too, such as the Scatter chart, times on a chart whose indexType is time, and the columns of a grid of cells, such as the Heatmap chart’s hours or months. A pill glides to the name of the category, or the time, under the pointer. Times get calendar ticks, as many as fit, each saying only what changed at it (14:00, 17 Nov, Dec, 2027). On a live chart, its ticks and pill scroll with the plot and fade at its ends. Other props go to its <div>.
ChartTooltip
What is under the pointer or the focus, in the chart’s own words: on a chart with series, the values of the category or the time. It shows at once and slides from one to the next. Other props go to its popup.
ChartTooltipContent
The category’s name, then a row for each shown series, with its change when the chart is ordered. On an x of times, a series with no row at that time shows its nearest one within half the smaller of its own usual gap and the chart’s rows’, with that row’s time, and is left out past it. Takes index, total and hideLabel.
ChartLegend
A toggle for each series that shows and hides it. Pointing at one, or focusing it, brings its series forward. Takes position, top or bottom.
ChartGroup
Charts inside it share the category under the pointer or the focus, by its key, so pointing at a day on one lights it on all of them.
Data attributes
CSS variables
Accessibility
- The plot is one stop in the tab order: a slider over the periods. Left and Right step through them, Home and End go to the ends, and Up and Down bring the item above or below forward. Each period’s ranks are read as the slider’s value, or with an item brought forward, that item’s alone.
- A hidden table holds every rank, and every amount with
rankBy, for screen readers and for copying. - Loading, an error and new data are announced in a status region.
- Names and ranks at both ends tell the lines apart without colour. Forced colours draw each item in a system colour, and a line that steps back half as thick.
- A name or rank that steps back takes the muted text colour, so it still reads.
- When the system asks for less motion, lines move to their new ranks at once and only fade.
- The chart is a
<figure>named bylabel. - Escape closes the tooltip and nothing above the chart.
- The legend’s toggles say whether each series shows. When every series is hidden, a button shows them all again and takes the focus.
For agents
What an agent reads on this example with snapshot(), and the actions it can call with act().
The Agent bridge page sets up snapshot() and act() in your app.