Range
Range slider form control. Reach for a range when a user picks a numeric value from a continuous or stepped scale where approximate selection is acceptable.
Usage
When to use
- Volume, brightness, or other continuous scales
- Picking an approximate numeric value within a known range
- Filters where rough selection is good enough
When not to use
- Precise numeric input - use a number input
- Picking from a small set of named options - use a radio
- Values where the minimum and maximum are not known
Do
- Set sensible
min,max, andstepattributes - Pair with a visible current value if precision matters
- Associate the range with a
<label>
Don't
- Use a range for inputs that require exact typed values
- Hide the current value when precision matters
API
Slots
| Slot | Required | Description |
|---|---|---|
label | Yes | Visible label text for the range input. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
name | string | - | Name attribute for the input element. |
id | string | - | HTML id of the input. Used to associate the label. |
value | number | - | Current value of the range input. |
min | number | - | Minimum allowed value. |
max | number | - | Maximum allowed value. |
step | number | - | Increment step between values. |
is_disabled | boolean | - | Renders the disabled attribute on the input. |
classes | array | - | Additional CSS class words merged into the root element. |
attributes | object | - | Additional HTML attributes spread on the root element. |
Classes
| Class | Capability | Default | Description |
|---|---|---|---|
.sm | Size | - | Small. |
.md | Size | Yes | Medium. |
.lg | Size | - | Large. |
Examples
Sizes
Sm, default, and lg variants stacked vertically. Track and thumb scale together.
With value
A slider starting at an authored value rather than the midpoint of its range.
With min max step
min, max and step set together, so the thumb moves in fixed increments across a bounded range.
Disabled
The disabled state, which mutes the track and thumb and drops the control out of the tab order.
Accessibility
- WCAG 2.2 AA
- Native
<input type="range">semantics preserved min,max,stepattributes supported- Label association via
<label>element - Visible focus ring on the thumb