Scrub field
A number you change by dragging its label, with a ruler, detents and momentum.
%
Drag the label sideways. Shift for ×10, Alt for fine steps.
Autumn launch
When to use
- Design and media values people tune by feel: opacity, radius, blur, gain.
- Values with meaningful stops, like 25, 50 and 75 percent.
When not to use
- The value is money or a count that must be typed exactly; use a number field.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/scrub-field
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
ScrubField
12 props
PropTypeDefaultDescription
label *string—
valuenumber—
defaultValuenumber0
onValueChange((value: number) => void)—
minnumber0
maxnumber100
stepnumber1
unitstring—Shown after the number, e.g. "%" or "px".
detentsnumber[][]Values that catch the scrub, e.g. [25, 50, 75].
pixelsPerStepnumber2Pointer travel per step while scrubbing.
disabledbooleanfalse
classNamestring—
Keyboard
- ↑
- Moves to the previous item or value.
- ↓
- Moves to the next item or value.
- Home
- Jumps to the first item or the minimum.
- End
- Jumps to the last item or the maximum.
- Enter
- Activates the focused control.
Accessibility
It exposes spinbutton semantics, with aria-hidden, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext and aria-invalid kept in step with state.
Motion
- State changes animate with the library's shared durations and curves, so its timing matches every other part.
- Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/scrub-field.mdThe index of every part is at /llms.txt.