Slider
Selecting from a continuous range, which is imprecise by nature and needs a numeric partner.
Definition
A slider lets the user select a value along a range by dragging. It is good for approximate values and poor for precise ones, which is why it usually needs an accompanying numeric input.
Craft convention. True because the industry converged on it. Breaking it costs familiarity, not correctness.
On this plate
Reach for this when
- Approximate values within a bounded range.
- Immediate visual feedback matters, as in filters.
Common mistakes
- Sliders used for values that need precision.
- Thumbs too small for touch.
- No keyboard support.
Requirements
- Show the current value at all times, not only while dragging.
- Pair with a numeric input for precise entry, especially in professional tools.
- Support arrow keys for single steps and Page Up and Page Down for larger jumps.
- Make the thumb large enough to hit on touch, at least 44px effective target.
- Label the minimum and maximum, and give aria-valuemin, aria-valuemax and aria-valuetext.
- For a range with two thumbs, prevent the handles from crossing and make each independently reachable by keyboard.
When a slider is the right control
Do
- Use it where the reader cares about approximate magnitude rather than an exact number.
- Show the current value, and let it be typed where precision matters.
- Support arrow keys, Home, End and page keys, with a sensible step.
- Make the thumb large enough to hit, and the track large enough to tap.
Do not
- Use a slider for a value with a wide range and a precise answer, such as a price the reader has in mind.
- Place a horizontal slider where a horizontal swipe also scrolls the page.
- Hide the value until after the drag ends.
- Use a two-handle range slider as the only way to enter a range.
In practice
- i.
The price filter nobody could set
Precision against rangeA slider covering zero to ten thousand made every value between two and three hundred a one-pixel target. A pair of number inputs, with the slider as a coarse companion, served both kinds of reader.
- ii.
Sliding against the page
Touch conflictsA horizontal slider inside a vertically scrolling page competes with the swipe gesture on narrow screens, so drags are lost and the page jumps. Larger touch targets and a typed alternative are what make it usable.
Local chart
CMP·008 · Region III · Grid F2
This entry and the entries it is stated to connect with. Each line is labelled with what the connection means.
Continue from here
Each link says what the connection is, so you can tell a principle from an alternative from a thing people mix this up with.
Principles behind this
The reasoning this solution is an application of.
- Fitts's LawLAW·002 · Law
- Natural MappingPRIN·008 · Principle
Depends on
Get these right first, or this one will not hold.
- Keyboard NavigationA11Y·002 · Accessibility
- Target SizeA11Y·011 · Accessibility
Often used with
These usually appear in the same screen or the same decision.
- Text InputCMP·003 · Component
- FilteringPAT·004 · Pattern