Components

Ruler

Measurement-style ticks with gradient sweep fill, optional value labels, and numeric readout.

Ruler

Measurement-style progress bar — minor / medium / major tick classification with a clip-path gradient sweep (destructive → yellow → teal-cyan). Built on Radix Progress. Use for granular values where the tick density itself communicates precision.

Preview
Open in
Loading preview...

Installation

Terminal
$npx shadcn@latest add @vandoko/ruler

Usage

import { Ruler } from "@/components/ruler";

export default function Page() {
  return <Ruler value={42} ticks={101} majorEvery={10} showLabels showValue />;
}

Custom Label Formatter

<Ruler
  value={6.5}
  max={10}
  ticks={41}
  majorEvery={10}
  labelFormatter={(v) => v.toFixed(0)}
  showLabels
/>

Props

PropTypeDefaultNotes
valuenumberCurrent value (required)
maxnumber100Max value
ticksnumber101Total tick count (≥ 2)
majorEverynumber10Index interval for major ticks (80% height)
mediumEverynumber5Index interval for medium ticks (45% height)
showLabelsbooleanfalseRender a label row under major ticks
labelFormatter(value, index) => stringFormat the label text
showValuebooleanfalseShow 0 / value / max readout
fillClassNamestringExtra classes on the gradient fill
tickClassName / majorTickClassName / mediumTickClassNamestringPer-kind tick overrides

Features

  • Three-level tick hierarchy — Minor (20%), medium (45%), major (80%) heights
  • Gradient sweep fill — Clip-pathed oklch gradient that reveals with progress
  • Optional label row — Numeric labels under major ticks only
  • Radix Progress semantics — Accessible by default
  • Token-drivenvar(--foreground), var(--muted-foreground), var(--card), var(--border)

Lineage

PropertyValue
Source@vandoko/ruler
Curated2026-04-21
LicenseMIT
Dependenciesradix-ui

On this page