caliper uidocs

Brush chart

Free

A chart you zoom by dragging a brush, with event annotations.

Installs components/ui/brush-chart.tsxDepends on @radix-ui/react-slot, d3-shape, lucide-reactMotion shared motion tokens
pnpm dlx shadcn@latest add https://caliperui.site/r/brush-chart.json
Daily revenue
Daily revenue
PointActualEvent
Jan 31, 2026110.3286058026949
Feb 1, 2026111.41137421215416
Feb 2, 2026112.69336486745937
Feb 3, 2026114.15567739543687
Feb 4, 2026115.77441406604554
Feb 5, 2026117.52134208299938
Feb 6, 2026119.36467601440859
Feb 7, 2026121.26995867951817
Feb 8, 2026123.20101607905738
Feb 9, 2026125.12095990470253
Feb 10, 2026126.99320984456976
Feb 11, 2026128.78250735303743
Feb 12, 2026130.45589278975032
Feb 13, 2026131.98361884782787
Feb 14, 2026133.33997495695044
Feb 15, 2026134.50399981419793v2 launch
Feb 16, 2026135.460062295891
Feb 17, 2026136.19829465131374
Feb 18, 2026136.71486597298707
Feb 19, 2026137.012088364664
Feb 20, 2026137.09835286475754
Feb 21, 2026136.98789690098792
Feb 22, 2026136.70040972090447
Feb 23, 2026136.26048673319784
Feb 24, 2026135.69694788193405
Feb 25, 2026135.04203894397213
Feb 26, 2026134.330537884438
Feb 27, 2026133.59879103630553
Feb 28, 2026132.8837058149575
Mar 1, 2026132.2217278831683
Mar 2, 2026131.64783111288503
Mar 3, 2026131.19454833553738
Mar 4, 2026130.8910697422142
Mar 5, 2026130.76243392022664
Mar 6, 2026130.82883394529514
Mar 7, 2026131.10505776000102
Mar 8, 2026131.60007834759438
Mar 9, 2026132.316805058892
Mar 10, 2026133.25200298387614
Mar 11, 2026134.39638260249257
Mar 12, 2026135.73485723010728
Mar 13, 2026137.24696112289723
Mar 14, 2026138.9074166559965
Mar 15, 2026140.68683485588522
Mar 16, 2026142.55252987279067
Mar 17, 2026144.4694248211904
Mar 18, 2026146.40102388437256
Mar 19, 2026148.31042374259815
Mar 20, 2026150.16133629461314
Mar 21, 2026151.91909432928094
Mar 22, 2026153.55161227661645
Mar 23, 2026155.03027541241295
Mar 24, 2026156.33073287345664
Mar 25, 2026157.43357250607207
Mar 26, 2026158.32485884555896
Mar 27, 2026158.99651931720703
Mar 28, 2026159.44656795589282
Mar 29, 2026159.67916044419746
Mar 30, 2026159.70447894374416
Mar 31, 2026159.5384499114866
Apr 1, 2026159.20230272125693

Jan 31, 2026 – Apr 1, 2026

Selected Jan 31, 2026 to Apr 1, 2026.

When to use #

Use it for

  • Long histories where people need to focus on a range.
  • Marking releases and incidents on a trend.

Skip it when

  • Short series.

Installation #

terminal
pnpm dlx shadcn@latest add https://caliperui.site/r/brush-chart.json

Adds its 5 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage #

This is the code behind the preview above.

example.tsx
import { useState } from "react"
import { BrushChart } from "@/components/ui/brush-chart"

export function ZoomableHistory() {
  const start = Date.UTC(2026, 0, 1);
  const data = Array.from({ length: 120 }, (_, index) => ({ date: start + index * 86400000, value: 100 + index * 0.6 + Math.sin(index / 6) * 8 }));
  const [range, setRange] = useState<[number, number]>([start + 30 * 86400000, start + 90 * 86400000]);
  return (
    <div className="w-full max-w-2xl">
      <BrushChart label="Daily revenue" data={data} range={range} onRangeChange={setRange} annotations={[{ date: start + 45 * 86400000, label: "v2 launch" }]} />
    </div>
  );
}

API reference #

BrushChart

component
PropTypeDefault
label *string—
data *readonly BrushPoint[]—
range *[number, number]—
onRangeChange *(range: [number, number]) => void—
minSpannumber7 * 86400000
annotationsreadonly BrushAnnotation[][]
loadingboolean—
errorstring—
classNamestring—

Accessibility #

It exposes slider and status semantics, with aria-label, aria-hidden, aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext kept in step with state. Changes that matter are announced through a live region.

KeyBehaviour
EscapeCloses or cancels, then returns focus to where it came from.
←Moves to the previous item or value.
PageDownMoves by a larger step, or to the next page.
→Moves to the next item or value.
PageUpMoves by a larger step, or to the previous page.
HomeJumps to the first item or the minimum.
EndJumps to the last item or the maximum.

Motion #

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.