Skip to content

role slider

Slider draft v0.1.0

Lets people pick a value in a range by moving a thumb along a track.

A slider sets a value whose position in a range matters more than its exact figure: a volume, a brightness, a price ceiling. A thumb slides along a track between a minimum and a maximum, by steps; the value can be shown next to the label. When the exact number matters, a Number field is better, alone or next to the slider.

Guidelines

From apps/docs/content/components/slider.md

Overview

A slider sets a value whose position in a range matters more than its exact figure: a volume, a brightness, a price ceiling. People drag the thumb, activate a point of the track or press the arrow keys; the value can be shown next to the label. When the figure matters, a Number field is the better control, alone or next to the slider.

This page applies to every platform. Where a platform differs, the difference sits under a sub-heading named after it (Web, iOS, Android, Desktop); everything else holds everywhere.

When to use

  • A continuous or stepped setting people adjust by feel: volume, brightness, zoom.
  • A ceiling or a floor in a range (maximum price), with the value shown.

When not to use

  • An exact number. Use a Number field.
  • A range between two values. Two thumbs are not specified; use two Number fields.
  • A choice among a few named options. Use a Radio group.

Sizes

Size Use for
Small Inline in panels and toolbars: a 4 px track with a 16 px thumb.
Medium Forms and settings, the default: an 8 px track with a 20 px thumb.

The control stays 24 px high at both sizes, so the whole track is a pointer target.

States

State How it happens What changes
Default Resting. A neutral track with the brand thumb at the value’s position.
Hover A pointer rests over the control. Needs a pointing device: there is no hover on touch. The thumb takes the brand hover color.
Active The thumb is being dragged, or a key is held. The thumb takes the brand press color.
Focus visible Keyboard focus. The shared focus ring appears around the whole track. Pointer focus shows no ring.
Disabled disabled property. Track, thumb, label and value drop to the shared disabled colors.

The track has no filled portion before the thumb: browsers do not all offer one without script. It is an open question.

Content

  • The label names the quantity, with its unit when the value is shown: Volume, Maximum price (€).
  • Show the value when the figure helps; hide it when the position says enough.
  • Choose a step people can reason about: 1, 5, 10, 0.5.

Accessibility

The Specification tab lists the full accessibility contract, grouped into what holds on every platform and what is specific to one. Each statement there links the source it comes from. This section explains the decisions behind it.

Web

iOS

  • A slider is a horizontal track with a thumb that people adjust between a minimum and a maximum; consider a label to introduce it and live feedback as the value changes (Apple HIG: Sliders). The 24 pt control falls under the 44 by 44 pt hit region today (Apple HIG: Accessibility, mobility).

Android

  • Number field (an exact number)
  • Progress bar (a value shown, not set)