Skip to content
Site volume
Colourway

Components

Slider

Pick a value or a range; the ruler variant is the estimator's printer's ruler with a carriage thumb.

Import from@maxgrits/overprint-react/slider
On this page

Example#

Look of this example
$6,500
Live render of examples/slider/basic.tsx

Usage#

Use a slider to pick a value or a range where the rough position matters more than the exact figure: a budget, a team size, a timeline. For an exact number someone already knows, an Input with type="number" is faster.

  • Default draws an 8 px track, a 28 px disc thumb and a value chip above the thumb while it moves or holds focus.
  • variant="ruler" is the estimator's printer's ruler: minor ticks every step, labelled major ticks at marks, and a carriage thumb that holds the formatted value.
  • Ranges. Pass [lo, hi] as the value for two thumbs; each thumb gets its own name through thumbLabels.
  • format prints the value everywhere it shows, in the chip, the carriage and aria-valuetext, so a screen reader hears "$6,500", not "6500".
  • Phones. The thumb's hit area is 44 px; below 30rem the ruler drops minor ticks and labels every other major one.

Anatomy#

$6,500
The parts of examples/slider/basic.tsx, numbered:
  1. RulerBaseline, minor ticks every step, major ticks at the marks..mk-slider-ruler
  2. CarriageThe ruler's thumb: a plate holding the formatted value..mk-slider-carriage
  3. Mark labelsTabular figures in the label role..mk-slider-marks

Volume#

Reading layer: the track, the thumb and the ruler print the same at every volume.

  • Quiet

    $6,500

    Docs, forms, legal and long reads. Flat inks, no art in motion.

  • Studio

    $6,500

    The site default. Art on its own plates, one display moment per view.

  • Press

    $6,500

    Hero moments, covers and campaigns. Halftone fields and the second ink.

  • Rave

    $6,500

    Launches, posters and the 404. Every ink, and the words still win.

Content#

  • The label names the quantity and its unit lives in format: "Budget" with "$6,500", never "Budget ($)".
  • Mark only the values people reason with: the ends and one or two round numbers.
  • Prices stay literal (D-I2): a slider that sets a budget shows the real figure, not "a bit" or "loads".

Do and don't#

Do

$6,500

A control for picking a value.

Don't

Your estimate

$3,200 to $4,800

A readout is not a control; it only reports.

A slider is for choosing. When the band is the result of other answers, show it with RulerReadout, which nobody tries to drag.

Accessibility#

  • Each thumb is a slider with aria-valuetext from format, so prices are read as prices.
  • Inside Field the thumbs take the field's label; range thumbs add "minimum" and "maximum".
  • Thumb hit areas are 44 px.
KeysWhat happens
TabMoves focus to the thumb (each thumb of a range is its own stop)
LeftorRight,UporDownMove one step
Page UporPage DownMove one large step (10 steps by default)
HomeorEndJump to the minimum or the maximum

The colour pairs it prints, with their contrast on both papers:

TextSurfaceRoleBoneNight
--mk-on-slab--mk-slablabel 16.49:1 · Lc 98.7, passes 16.21:1 · Lc 95.1, passes
--mk-text--mk-surfaceuinot in this looknot in this look
--mk-text--mk-surface-raiseduinot in this looknot in this look

Process at Studio, normal contrast. Every look: the press check.

Props#

PropTypeDefaultDescription
minnumbernone
maxnumbernone
stepnumbernone
largeStepnumber10PageUp / PageDown (default 10 × step).
valueSliderValuenone
defaultValueSliderValuenone
onValueChange((value: SliderValue) => void)none
onValueCommitted((value: SliderValue) => void)noneWhen a drag or key press ends.
formatIntl.NumberFormatOptions | ((value: number) => string)noneDrives the value chip, the carriage and `aria-valuetext` (prices stay literal, D-I2): a function for client callers, or `Intl.NumberFormat` options (serialisable, so a server component can pass them).
localestringthe page'sThe locale for `Intl.NumberFormat` options (default the page's).
marksreadonly SliderMark[]noneMajor ticks (ruler) or points under the track (default).
namestringnoneThe form value's name (hidden inputs post with the form).
variant"default" | "ruler"none
disabledbooleannone
labelstringnoneThe accessible name when the slider is not inside `Field`.
thumbLabelsreadonly [string, string]"minimum" and "maximum"Range thumbs' names after the label (default "minimum" and "maximum").
idstringnoneFrom `Field`: the thumbs take `{id}-label` as their name.
aria-labelledbystringnone
aria-describedbystringnone
aria-invalid"false" | "true" | booleannone
refRef<HTMLDivElement>none
classNamestringnone
styleCSSPropertiesnone

Generated from SliderProps in packages/overprint-react/src/reading/slider/slider.tsx.

Tokens#

Changelog#

Arrived in 0.1.0.

0.1.024 October 2026

  • MinorreactThe reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.