Skip to content
Haze UI

Brush chart

Zoom a dense ordered series with two native window handles, pan or reset the window, and inspect values and named events.

pnpm dlx shadcn@latest add @haze/brush-chart
Open preview in a new tab
Livesmall script

When to use

  • A long metric needs a focused view while retaining its complete overview.
  • Events must be read alongside the measurements within a selected interval.

When not to use

  • A short series fits on one axis without zooming. Use line-chart.

Installation

Add the Haze registry to components.json once, then install Brush chart with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/brush-chart
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
labelstringDaily build volumeVisible metric caption.
data{ label: string; value: number; event?: string }[]–Ordered readings; nonfinite measurements are excluded while finite negative values remain valid.
unitstringbuildsMeasurement unit.
initialWindownumber12Initial count of most-recent readings; clamped to at least one.
classstring–Additional classes on the chart figure.

Keyboard interactions

Arrow keysHomeEnd
Resize either window endpoint or read the focused window.
EnterSpace
Pan, reset to all data or select the latest seven readings.

Accessibility

  • Independent native range controls select both window endpoints and expose their period names, with another range reading inside the window.
  • The overview and main line are decorative; the disclosure lists every finite value and its event for access without scripts.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Brush chart" with `npx shadcn@latest add @haze/brush-chart`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import BrushChart from "@/components/haze/ui/brush-chart.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/brush-chart.md

  • Customize with real content

    Adapt the Haze brush-chart ui for our product. Replace the demo values of these props with our real content: label, data, unit, initialWindow, class. Keep the layout, the heading level rules and these accessibility details: Independent native range controls select both window endpoints and expose their period names, with another range reading inside the window. The overview and main line are decorative; the disclosure lists every finite value and its event for access without scripts. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using brush-chart, check it fits: use it when a long metric needs a focused view while retaining its complete overview.; events must be read alongside the measurements within a selected interval.. Avoid it when a short series fits on one axis without zooming. use line-chart.. Alternatives: @haze/line-chart, @haze/streamgraph, @haze/sparkline.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog