Skip to content

Ruler Slider

Pro

Pick a value on a moving scale: the ticks slide under a fixed line, as in a photo editor. Drag or flick the ruler, and double-click to reset.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 10, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Ruler Slider needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
33
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Put a RulerSliderLabel and a RulerSliderValue in the header; the label names the slider, and a press on the value resets it.

straighten-ruler.tsx

RulerSlider

<div>
PropTypeDefaultDescription
valuenumber—
defaultValuenumber—
onValueChange—A value change, from a drag, a flick, a key, a reset, or Escape (cancel).
onValueCommitted—The value at the end of a drag (after the flick), a key press, or a reset.
onMovingChange—true from the press until a flick stops: a host can show a grid while the ruler moves.
minnumber-45Default -45.
maxnumber45Default 45.
stepnumber1The value grid and the arrow-key step. Default 1.
largeStepnumber—Shift + arrow and Page Up or Down. Default 10 steps.
tickStepnumber—The value of one tick (6px). Default: step.
majorEverynumber5A major (long) tick each this many ticks, counted from 0. Default 5.
originnumber | "center" | "start""center"The value with the dot, where a drag holds for 6px: center (0, kept inside the range), a number, or start (no dot; the span grows from min). Default center.
resetValuenumber—The value of a reset. Default: defaultValue, else the origin.
labelsboolean | ((value: number) => string)—Numbers on the ticks: true (the formatted value), or a function. Not on vertical. The arc is made for up to 250 ticks: past half a turn of its circle the ticks overlap.
labelEverynumber—A label each this many ticks. Default majorEvery × 2.
variant"arc""straight""vertical""straight"straight (default), arc (a curved ruler), or vertical (higher values up).
size"default""lg""sm""default"
formatNumberFormatOptions—The number format of the value, the labels, and aria-valuetext.
localeLocalesArgument—
disabledbooleanfalse
readOnlybooleanfalseThe value shows and follows a controlled value, but takes no input.
invalidboolean—Shown as invalid (an invalid Field around it does the same).
namestring—
formstring—
aria-labelstring—The name of the slider when there is no RulerSliderLabel.
getAriaValueText—The spoken value. Default: the formatted value.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

RulerSliderLabel

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

RulerSliderValue

<button>
PropTypeDefaultDescription
children—The text: the formatted value by default. Return a unit around it ("5600 K").
...props<button> attributes—Every other attribute goes to the <button>, with a ref.
  • Use it for an angle, exposure, white balance, or zoom.
  • Use variant straight, arc, or vertical for the shape.
  • Use origin for the value that holds the drag and shows a dot.
  • Use onMovingChange to show something while the ruler moves, such as a grid.
  • To jump to a point on a fixed track, or to pick a range, use a Slider.
  • To show a measured value, use a Meter.
Arrow keysChanges the value by one step.
Shiftarrow keysorPage UporPage DownChanges the value by largeStep.
HomeorEndGoes to the minimum or the maximum.
DeleteorBackspaceResets the value.
EscapeDuring a drag: cancels the drag and restores the value.

It uses a native range input, so the arrow keys step the value and a form can read it with name.

The touch target stays 44px high.

No mirror in right to left: more stays to the right, and only the label and the value swap.

The fixed red line marks the value; it turns to the destructive color when the ruler is invalid.

Hover
hover · the ticks go from 67% to full on hover, focus, and drag
Press
elastic · the ticks grow 15% while held and spring back with one small wobble
Release
glide · a key, a reset, or a new value glides the ruler to its tick with the speed it has
Origin dot
statusPop · the dot grows when the value lands on the origin

Built with

Installs with Ruler Slider

Components
Direction,Slider
  1. AddedRuler Slider, with Direction, Slider.
Open the release