RulerPicker
A swipeable tick scale with a lit value flag, under a heading that carries an inline mode select.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
A swipeable tick scale with a lit value flag, under a heading that carries an inline mode select.
Accessibility
Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.
Install and import
npx shadcn@latest add @prism/ruler-picker
import { RulerPicker } from '@/components/prism/RulerPicker';
In a no-build prototype, read it from the bundle instead: const { RulerPicker } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
label | string | — | Quiet prefix in the heading, e.g. "Simulate". |
options | (RulerOption | string)[] | — | Inline mode select shown after the label. Omit for a plain ruler. |
mode | string | — | |
onModeChange | (mode: string) => void | — | |
value | number | — | |
min | number | — | |
max | number | — | |
step | number | — | Smallest increment; the value always snaps to it. |
majorEvery | number | — | Labelled major tick every N steps. |
pxPerStep | number | — | Pixels per step — the scale's "gearing". Larger = finer control. |
formatValue | (v: number) => React.ReactNode | — | |
formatTick | (v: number) => React.ReactNode | — | |
onChange | (value: number) => void | — | |
caption | string | — | Accessible name for the scale. |