Components · Forms · Slider
Back to Slider typesSlider
Use for picking a numeric value, or a range of two values, by dragging a thumb along a track, like a volume level or a price range filter - one Slider component, controlled by properties, not a raw browser range input styled on its own.
Properties
Track thickness, label text and value are properties of the same component, not separate sliders - change them below to check both types and every state in the Live Preview. There is no configurable corner radius: the track and thumb are always a full pill shape, since a slider control has no practical use for sharp or partial corners.
Live Preview
Both types compared side by side, each in all 4 states - Disabled applies to the whole control, and Focused shows a focus ring on the thumb rather than the track. One full matrix is rendered per selected Track thickness, at the chosen Label and Value.
Try it
A real, working Single slider - drag the thumb, click anywhere on the track, or focus it and use the Left/Right/Up/Down arrow keys (or Home/End to jump to the bounds). Respects the configured Min, Max, Step, prefix/suffix and tick marks above. The Range type's two-thumb drag interaction (including crossing behavior) is a separate, larger feature and isn't built here - the Live Preview above still shows its static appearance.
When to use
Any control where a user picks a numeric value, or a range of two values, along a continuous scale.
Validation
Dragging a thumb can't produce an out-of-range value - the track itself constrains the position - so validation only matters for the paired numeric input some Slider variants offer for typing an exact value.
- Range validation - validate the typed value against the slider's min and max on blur, e.g. typing "150" on a 0-100 slider, and either clamp it to the nearest bound or reject it.
- Error message - state the actual bounds, e.g. "Enter a value between 0 and 100," rather than a generic "Invalid value."
- Step validation - if the slider only allows fixed increments, snap a typed in-between value to the nearest valid step rather than accepting it as entered.
- Required marking - a slider always shows some numeric position, so it usually can't represent "no answer" the way a text field can - only mark it required if this variant explicitly supports a distinct unset state; otherwise there's nothing meaningful to validate as "empty."
Component Guide
Overview
Slider lets someone pick a numeric value, or a range of two values, by dragging a thumb along a track - used for continuous or coarse-grained values where the exact number matters less than quickly finding the right position, like a volume level or a price filter.
When to Use
- A value picked along a continuous scale - volume, brightness, zoom level.
- A bounded range of two values - a price range filter with a low and high thumb.
- A scrubber for position within a duration - a progress scrubber.
When Not to Use
- A value that needs precise, exact keyboard entry - use Number instead - dragging is imprecise for exact values like "37".
- A choice from a small set of discrete, named options - use Group Button, Radio, or Select rather than a slider with only a few valid stops.
- A single date or time value - use Date Picker or Time - a slider doesn't communicate calendar or clock context.
Best Practices
- Show the current value as text alongside the track, since position alone is hard to read precisely.
- Choose a track thickness and thumb size that stay comfortably draggable on touch as well as with a mouse.
- Support arrow-key adjustment in fixed increments as an alternative to dragging.
Do and Don't
Do
An approximate setting the user judges by eye, with the current value shown so the choice is still repeatable.
Don't
A slider cannot hit an exact figure, and no value is shown to confirm one. Anything that must be precise belongs in a Number field.
Accessibility
- Exposed with proper slider role semantics, including the current value, minimum, and maximum, all announced to assistive technology.
- Fully operable by keyboard - arrow keys adjust the value, Home/End jump to the bounds.
- The focus ring appears on the thumb itself, independent of any hover-only styling.
Related Components
Number, Rating, Progress.
{
"component": "Slider",
"category": "Forms",
"summary": "Slider lets someone pick a numeric value, or a range of two values, by dragging a thumb along a track - used for continuous or coarse-grained values where the exact number matters less than quickly finding the right position, like a volume level or a price filter.",
"whenToUse": [
"A value picked along a continuous scale - volume, brightness, zoom level.",
"A bounded range of two values - a price range filter with a low and high thumb.",
"A scrubber for position within a duration - a progress scrubber."
],
"whenNotToUse": [
"A value that needs precise, exact keyboard entry - use Number instead - dragging is imprecise for exact values like \"37\".",
"A choice from a small set of discrete, named options - use Group Button, Radio, or Select rather than a slider with only a few valid stops.",
"A single date or time value - use Date Picker or Time - a slider doesn't communicate calendar or clock context."
],
"bestPractices": [
"Show the current value as text alongside the track, since position alone is hard to read precisely.",
"Choose a track thickness and thumb size that stay comfortably draggable on touch as well as with a mouse.",
"Support arrow-key adjustment in fixed increments as an alternative to dragging."
],
"doAndDont": {
"do": "An approximate setting the user judges by eye, with the current value shown so the choice is still repeatable.",
"dont": "A slider cannot hit an exact figure, and no value is shown to confirm one. Anything that must be precise belongs in a Number field."
},
"accessibility": [
"Exposed with proper slider role semantics, including the current value, minimum, and maximum, all announced to assistive technology.",
"Fully operable by keyboard - arrow keys adjust the value, Home/End jump to the bounds.",
"The focus ring appears on the thumb itself, independent of any hover-only styling."
],
"relatedComponents": [
"Number",
"Rating",
"Progress"
]
}