Components · FormNot verified with Figma

Range

A range lets the user pick one value from an ordered series by dragging a thumb, with the current value shown as text.

Every example on this page is the real component, not a picture. There is no Figma component: the range was designed in the repo.

Playground

A native range input with a label, the current value and tick labels. Drag, click the track or use the arrow keys. Hover is forced with the State control; focus is live (press Tab).

Type
Recommended
State

Markup for this selection

HTML

Overview

A range lets the user pick one value from an ordered series by dragging a thumb, with the current value shown as text.

Range is a native <input type="range"> with a label, the value as text and optional tick labels. It is stepped over named values by default, but a numeric range between a minimum and a maximum works too. It has no Figma component: it was designed in the repo.

This documentation has three pages. Examples & Guidelines (this page) shows when and how to use a range. Specifications holds the values: tokens, dimensions, states and requirements. Code shows how to add one to a page.


Usage

When to use

Use a range when the value is a position on an ordered series and a precise number is not the point. Use it to:

  • Pick an easing or a duration from named steps (the Motion sections of these docs)
  • Pick a number between a minimum and a maximum, such as an auto-hide time in seconds
  • Show a recommended step and let the user move away from it

When not to use

For two or three options, or on and off

For two or three named options use Pill segment control or eco-radio. For on and off use Switch. For an exact number use eco-input.

Do use a range for an ordered series of steps.
Do not use a range for on and off. Use a switch.

Quick reference

The user…Use
picks one value from an ordered series by draggingRange
picks one of two or three named optionsPill segment control or eco-radio
turns something on or offSwitch
types an exact numbereco-input

Do

  • Keep to about 4–12 steps in a 480px control.
  • Show the current value as text.
  • Mark the recommended step and explain the *.
  • Link range.css and range.js.

Don’t

  • Build a slider from divs.
  • Use it for two or three options.
  • Use it for exact numbers.
  • Let tick labels collide: use fewer via data-ticks.

Anatomy

Range

  1. Label. Always visible, linked with for and id. label-sm, text-secondary.
  2. Value. The current value as text, right of the label. body-sm. It comes from data-labels, or the number plus data-unit.
  3. Track. 2px high, border-primary, inside a 24px high hit area.
  4. Thumb. A 16px circle, surface-100. A 4px halo shows on hover.
  5. Tick labels. Optional, one per step, 12/16 text-tertiary. The recommended step gets a *.

Variants

Stepped over named values, or numeric between a minimum and a maximum.

Named steps with a recommended value

Numeric with a unit


Sizes

There is one size, the same on every breakpoint: a 24px hit area, a 2px track and a 16px thumb. The touch size on mobile is smaller than the usual 44px target; raise the input height at xs and sm if design wants it. Dimensions are under Sizes in Specifications.


Layout & Appearance

Width

The range fills its container. The examples use a 480px control. Keep to about 4 to 12 steps in a 480px control, and use fewer tick labels via data-ticks if they collide.

Appearance

A thin grey track with a black round thumb. There is no dark-mode variant. Token names and values are under Design Tokens in Specifications.


Behavior

Dragging

Drag the thumb or click the track and the thumb moves; the value text updates. The input fires the normal input event, so your page listens for it to apply the value.

Hover and focus

Hover shows a 4px halo around the thumb. Focus is a 2px ring that shows on keyboard focus only. States are listed under States in Specifications.

Disabled

A disabled range is not focusable and has a not-allowed cursor. The track, the thumb and the texts use disabled tokens.


Accessibility

All requirements are listed under Accessibility Requirements in Specifications.

Keyboard support

The arrow keys, Home, End, PageUp and PageDown are the native keyboard control. Tab shows the focus ring.

Screen reader support

The control is the native <input type="range"> with a visible label. The tick labels are aria-hidden; the value is read through aria-valuetext, so a step is announced by its name.



References