Range slider
A range slider selects a low and a high value on one track, such as a price range. The handles stop at each other instead of crossing, and the change mode sets when your page is told the range: on every movement or when a drag ends. Drag the handles below, or tab to them and press the arrow keys.
Reference docs
Choosing sliders and dials
Four components pick a value with a handle the reader drags. Each suits a different job:
- Slider: one value picked along a track, such as volume or brightness.
- Range slider: a low and a high value on one track, such as a price range.
- Dial: one value picked by turning a knob between two stops, such as an oven temperature.
- Continuous dial: a knob with no stops that adds up every turn, such as a jog wheel or a fine-tuning control.
One job belongs elsewhere. An exact number the reader knows is a number field.
Built in
- Two handles that stop at each other instead of crossing, with
keeping a set distance between them (Range and gap).min-value-gap - Value labels over each handle while it is pressed or focused, with
(Value labels).labeled - Five change modes that pace the
changeevent, from every movement to a drag's end (Change mode). - Both values submit with a form, under
andstart-name (Forms).end-name - Arrow, PageUp, PageDown, Home, and End keys on each handle (Keyboard and focus).
- A touch target of at least 48 by 48 pixels around each handle, even when the track looks smaller (Pointer and touch).
Using range sliders well
- Choose a range slider for a minimum and a maximum; choose a Slider for one value.
- Show formatted values, such as currency or units, with
andstart-label , bound to the values so they follow each move.end-label - Mark the stops with
set totickmarks , and setvalues to match, when only a few values make sense.step - Leave the touch target at 48 by 48 pixels, and keep other controls clear of it.
These rules follow Material 3 Expressive's guidance for sliders, on material.io.
Size
sizeextra-smallextra-largeextra-small
touch-targetnoneoverflowwrapperoverflow
Range and gap
minmaxstepstart-valueend-valueminmaxpage-valuestep
The handles can meet but never cross. min-value-gap
Value labels
labeledstart-labelend-label
Fixed text does not follow the value. To show a formatted readout, such as currency or units, write it into the label text, as the third range slider below does.
Orientation
orientationhorizontal
Tickmarks
tickmarkscontrast-end-stopvaluesstepnonetrack-background slot holds content, because your content takes the track's place.
Use valuesstep
Change mode
change-modechange event fires while a handle moves; the input event fires on every movement in every mode. Omit it and the mode is interaction-ended
immediatedebouncedthrottledrate-limit-delayadaptiverate-limit-delayasyncSinksink-duty-cycleasyncSinkadaptivethrottled
Forms
A range slider in a form submits two entries, the start value under start-nameend-nameend-namestart-namestart-namenamenamestart-value and end-value attributes.
The preview cannot submit a form, so the submit button reports a saved message instead, and the preset buttons move the start handle. Your own page submits the form as usual.
Disabled
disabled<fieldset> is disabled too.
Properties
| Property | Attribute | Type | Description |
|---|---|---|---|
ariaDescribedBy | aria-describedby | string | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
ariaDescription | aria-description | string | Not announced by assistive technology. ariaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
ariaErrorMessage | aria-errormessage | string | The ID of the element describing the value's error. Used only while ariaInvalid is "true". |
ariaInvalid | aria-invalid | string | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
ariaLabelledBy | aria-labelledby | string | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
asyncSink | ValueChangeSink | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than rateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. | |
changeMode | change-modedebounced, immediate, interaction-ended, throttled, adaptive | ChangeEventModeChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by rateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against asyncSink. See Change mode. |
disabled | disabled | boolean | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
endAriaLabel | end-aria-label | string | The end handle's accessible name. The name read is this text followed by "end". |
endAriaValueText | end-aria-valuetext | string | The text a screen reader announces for the end handle's value. Unset, it falls back to endLabel, then to the number. |
endLabel | end-label | string | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless endAriaLabel is set, and its value text unless endAriaValueText is set. It does not follow endValue. See Value labels. |
endName | end-name | string | The name the ending value submits under. Falls back to startName. See Forms. |
endValue | end-value | number | The end handle's value. It cannot fall below startValue plus minValueGap. Unset, it is two thirds of the way from min to max.An assignment that is not a finite number is ignored, and endValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
formread-only | HTMLFormElement | The form the component belongs to, or null when it has none. | |
labeled | labeled | booleandefault false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
labelsread-only | NodeList | The <label> elements associated with the element. | |
max | max | numberdefault 100 | The highest value the range can take. If min is not below it, min becomes max less 1.An assignment that is not a finite number is ignored, and max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
min | min | numberdefault 0 | The lowest value the range can take. A minimum that is not below max is replaced by max less 1.An assignment that is not a finite number is ignored, and min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
minValueGap | min-value-gap | number | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and minValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
name | name | string | The name the element's value is submitted under with its form. See Forms. |
orientation | orientationhorizontal, vertical | SliderOrientationSliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
pageValue | page-value | number | How far PageUp and PageDown move the value. Defaults to ten times step.An assignment that is not a finite number is ignored, and pageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
rateLimitDelay | rate-limit-delay | numberdefault 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and rateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
sinkDutyCycle | sink-duty-cycle | numberdefault 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
size | sizeextra-small, small, medium, large, extra-large | SizeSize.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
softDisabled | soft-disabled | booleandefault false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
startAriaLabel | start-aria-label | string | The start handle's accessible name. The name read is this text followed by "start". |
startAriaValueText | start-aria-valuetext | string | The text a screen reader announces for the start handle's value. Unset, it falls back to startLabel, then to the number. |
startLabel | start-label | string | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless startAriaLabel is set, and its value text unless startAriaValueText is set. It does not follow startValue. See Value labels. |
startName | start-name | string | The name the starting value submits under. Falls back to name, so a range with only name submits both values under it, start first. See Forms. |
startValue | start-value | number | The start handle's value. It cannot pass endValue less minValueGap. Unset, it is a third of the way from min to max.An assignment that is not a finite number is ignored, and startValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
step | step | numberdefault 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
tickmarks | tickmarksnone, contrast-end-stop, values | SliderTickmarkSliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the track-background slot is filled. See Tickmarks. |
touchTarget | touch-targetnone, overflow, wrapper | TouchTargetTouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Slots
| Slot | Description |
|---|---|
track-background | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Events
| Event | Type | Detail | Description |
|---|---|---|---|
input | RangeTrackControlInputEvent | RangeTrackControlInputEventDetail | Fired during interaction. Its detail carries both handle values, as startValue and endValue. It bubbles and is composed. |
change | RangeTrackControlChangeEvent | RangeTrackControlChangeEventDetail | Fired when interaction ends or based on changeMode. Its detail carries both handle values, as startValue and endValue. It bubbles. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Props
| Prop | Type | Description |
|---|---|---|
ariaDescribedBy | string | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
ariaDescription | string | Not announced by assistive technology. ariaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
ariaErrorMessage | string | The ID of the element describing the value's error. Used only while ariaInvalid is "true". |
ariaInvalid | string | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
ariaLabelledBy | string | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
asyncSink | ValueChangeSink | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than rateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. |
changeMode | ChangeEventModeTypeChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by rateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against asyncSink. See Change mode. |
disabled | boolean | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
endAriaLabel | string | The end handle's accessible name. The name read is this text followed by "end". |
endAriaValueText | string | The text a screen reader announces for the end handle's value. Unset, it falls back to endLabel, then to the number. |
endLabel | string | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless endAriaLabel is set, and its value text unless endAriaValueText is set. It does not follow endValue. See Value labels. |
endName | string | The name the ending value submits under. Falls back to startName. See Forms. |
endValue | number | The end handle's value. It cannot fall below startValue plus minValueGap. Unset, it is two thirds of the way from min to max.An assignment that is not a finite number is ignored, and endValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
formread-only (ref) | HTMLFormElement | The form the component belongs to, or null when it has none. |
labeled | booleandefault false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
labelsread-only (ref) | NodeList | The <label> elements associated with the element. |
max | numberdefault 100 | The highest value the range can take. If min is not below it, min becomes max less 1.An assignment that is not a finite number is ignored, and max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
min | numberdefault 0 | The lowest value the range can take. A minimum that is not below max is replaced by max less 1.An assignment that is not a finite number is ignored, and min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
minValueGap | number | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and minValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
name | string | The name the element's value is submitted under with its form. See Forms. |
orientation | SliderOrientationTypeSliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
pageValue | number | How far PageUp and PageDown move the value. Defaults to ten times step.An assignment that is not a finite number is ignored, and pageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
rateLimitDelay | numberdefault 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and rateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
sinkDutyCycle | numberdefault 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
size | SizeTypeSize.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
softDisabled | booleandefault false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
startAriaLabel | string | The start handle's accessible name. The name read is this text followed by "start". |
startAriaValueText | string | The text a screen reader announces for the start handle's value. Unset, it falls back to startLabel, then to the number. |
startLabel | string | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless startAriaLabel is set, and its value text unless startAriaValueText is set. It does not follow startValue. See Value labels. |
startName | string | The name the starting value submits under. Falls back to name, so a range with only name submits both values under it, start first. See Forms. |
startValue | number | The start handle's value. It cannot pass endValue less minValueGap. Unset, it is a third of the way from min to max.An assignment that is not a finite number is ignored, and startValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
step | numberdefault 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
tickmarks | SliderTickmarkTypeSliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the slot="track-background" child is filled. See Tickmarks. |
touchTarget | TouchTargetTypeTouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Children
| Child | Description |
|---|---|
a child with slot="track-background" | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Events
| Prop | Argument | Description |
|---|---|---|
onInput | RangeTrackControlInputEvent | Fired during interaction. Its detail carries both handle values, as startValue and endValue. It bubbles and is composed. Its detail carries originalEvent. |
onChange | RangeTrackControlChangeEvent | Fired when interaction ends or based on changeMode. Its detail carries both handle values, as startValue and endValue. It bubbles. Its detail carries originalEvent. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Parameters
| Parameter | Type | Description |
|---|---|---|
AriaDescribedBy | string? | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
AriaDescription | string? | Not announced by assistive technology. AriaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
AriaErrorMessage | string? | The ID of the element describing the value's error. Used only while AriaInvalid is "true". |
AriaInvalid | string? | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
AriaLabelledBy | string? | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
AsyncSink | ValueChangeSink? | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than RateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. |
ChangeMode | ChangeEventMode?ChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by RateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against AsyncSink. See Change mode. |
Disabled | bool? | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
EndAriaLabel | string? | The end handle's accessible name. The name read is this text followed by "end". |
EndAriaValueText | string? | The text a screen reader announces for the end handle's value. Unset, it falls back to EndLabel, then to the number. |
EndLabel | string? | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless EndAriaLabel is set, and its value text unless EndAriaValueText is set. It does not follow EndValue. See Value labels. |
EndName | string? | The name the ending value submits under. Falls back to StartName. See Forms. |
EndValue | double? | The end handle's value. It cannot fall below StartValue plus MinValueGap. Unset, it is two thirds of the way from Min to Max.An assignment that is not a finite number is ignored, and EndValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
EndValueExpression | Expression<Func<double?>>? | Gets or sets an expression that identifies the bound value. |
Labeled | bool?default false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
Max | double?default 100 | The highest value the range can take. If Min is not below it, Min becomes Max less 1.An assignment that is not a finite number is ignored, and Max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
Min | double?default 0 | The lowest value the range can take. A minimum that is not below Max is replaced by Max less 1.An assignment that is not a finite number is ignored, and Min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
MinValueGap | double? | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and MinValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
Name | string? | The name the element's value is submitted under with its form. See Forms. |
Orientation | SliderOrientation?SliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
PageValue | double? | How far PageUp and PageDown move the value. Defaults to ten times Step.An assignment that is not a finite number is ignored, and PageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
RateLimitDelay | int?default 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and RateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
SinkDutyCycle | double?default 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
Size | Size?Size.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
SoftDisabled | bool?default false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
StartAriaLabel | string? | The start handle's accessible name. The name read is this text followed by "start". |
StartAriaValueText | string? | The text a screen reader announces for the start handle's value. Unset, it falls back to StartLabel, then to the number. |
StartLabel | string? | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless StartAriaLabel is set, and its value text unless StartAriaValueText is set. It does not follow StartValue. See Value labels. |
StartName | string? | The name the starting value submits under. Falls back to Name, so a range with only Name submits both values under it, start first. See Forms. |
StartValue | double? | The start handle's value. It cannot pass EndValue less MinValueGap. Unset, it is a third of the way from Min to Max.An assignment that is not a finite number is ignored, and StartValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
StartValueExpression | Expression<Func<double?>>? | Gets or sets an expression that identifies the bound value. |
Step | double?default 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and Step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
Tickmarks | SliderTickmark?SliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the TrackBackground render fragment is filled. See Tickmarks. |
TouchTarget | TouchTarget?TouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Render fragments
| Parameter | Type | Description |
|---|---|---|
TrackBackground | RenderFragment? | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Event callbacks
| Parameter | Type | Description |
|---|---|---|
OnInput | EventCallback<RangeTrackControlInputEventArgs> | Fired during interaction. Its detail carries both handle values, as StartValue and EndValue. It bubbles and is composed. Its detail carries originalEvent. |
OnChange | EventCallback<RangeTrackControlChangeEventArgs> | Fired when interaction ends or based on ChangeMode. Its detail carries both handle values, as StartValue and EndValue. It bubbles. Its detail carries originalEvent. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Inputs
| Input | Type | Description |
|---|---|---|
ariaDescribedBy | string | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
ariaDescription | string | Not announced by assistive technology. ariaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
ariaErrorMessage | string | The ID of the element describing the value's error. Used only while ariaInvalid is "true". |
ariaInvalid | string | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
ariaLabelledBy | string | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
asyncSink | ValueChangeSink | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than rateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. |
changeMode | ChangeEventModeTypeChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by rateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against asyncSink. See Change mode. |
disabled | boolean | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
endAriaLabel | string | The end handle's accessible name. The name read is this text followed by "end". |
endAriaValueText | string | The text a screen reader announces for the end handle's value. Unset, it falls back to endLabel, then to the number. |
endLabel | string | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless endAriaLabel is set, and its value text unless endAriaValueText is set. It does not follow endValue. See Value labels. |
endName | string | The name the ending value submits under. Falls back to startName. See Forms. |
endValue | number | The end handle's value. It cannot fall below startValue plus minValueGap. Unset, it is two thirds of the way from min to max.An assignment that is not a finite number is ignored, and endValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
labeled | booleandefault false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
max | numberdefault 100 | The highest value the range can take. If min is not below it, min becomes max less 1.An assignment that is not a finite number is ignored, and max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
min | numberdefault 0 | The lowest value the range can take. A minimum that is not below max is replaced by max less 1.An assignment that is not a finite number is ignored, and min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
minValueGap | number | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and minValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
name | string | The name the element's value is submitted under with its form. See Forms. |
orientation | SliderOrientationTypeSliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
pageValue | number | How far PageUp and PageDown move the value. Defaults to ten times step.An assignment that is not a finite number is ignored, and pageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
rateLimitDelay | numberdefault 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and rateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
sinkDutyCycle | numberdefault 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
size | SizeTypeSize.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
softDisabled | booleandefault false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
startAriaLabel | string | The start handle's accessible name. The name read is this text followed by "start". |
startAriaValueText | string | The text a screen reader announces for the start handle's value. Unset, it falls back to startLabel, then to the number. |
startLabel | string | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless startAriaLabel is set, and its value text unless startAriaValueText is set. It does not follow startValue. See Value labels. |
startName | string | The name the starting value submits under. Falls back to name, so a range with only name submits both values under it, start first. See Forms. |
startValue | number | The start handle's value. It cannot pass endValue less minValueGap. Unset, it is a third of the way from min to max.An assignment that is not a finite number is ignored, and startValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
step | numberdefault 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
tickmarks | SliderTickmarkTypeSliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the track-background slot is filled. See Tickmarks. |
touchTarget | TouchTargetTypeTouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Content projection
| Content | Description |
|---|---|
an element with slot="track-background" | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Outputs
| Output | Event | Description |
|---|---|---|
cwInput | RangeTrackControlInputEvent | Fired during interaction. Its detail carries both handle values, as startValue and endValue. It bubbles and is composed. Its detail carries originalEvent. |
cwChange | RangeTrackControlChangeEvent | Fired when interaction ends or based on changeMode. Its detail carries both handle values, as startValue and endValue. It bubbles. Its detail carries originalEvent. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Props
| Prop | Type | Description |
|---|---|---|
ariaDescribedBy | string | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
ariaDescription | string | Not announced by assistive technology. ariaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
ariaErrorMessage | string | The ID of the element describing the value's error. Used only while ariaInvalid is "true". |
ariaInvalid | string | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
ariaLabelledBy | string | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
asyncSink | ValueChangeSink | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than rateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. |
changeMode | ChangeEventModeTypeChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by rateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against asyncSink. See Change mode. |
disabled | boolean | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
endAriaLabel | string | The end handle's accessible name. The name read is this text followed by "end". |
endAriaValueText | string | The text a screen reader announces for the end handle's value. Unset, it falls back to endLabel, then to the number. |
endLabel | string | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless endAriaLabel is set, and its value text unless endAriaValueText is set. It does not follow endValue. See Value labels. |
endName | string | The name the ending value submits under. Falls back to startName. See Forms. |
endValue | number | The end handle's value. It cannot fall below startValue plus minValueGap. Unset, it is two thirds of the way from min to max.An assignment that is not a finite number is ignored, and endValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
labeled | booleandefault false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
max | numberdefault 100 | The highest value the range can take. If min is not below it, min becomes max less 1.An assignment that is not a finite number is ignored, and max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
min | numberdefault 0 | The lowest value the range can take. A minimum that is not below max is replaced by max less 1.An assignment that is not a finite number is ignored, and min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
minValueGap | number | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and minValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
name | string | The name the element's value is submitted under with its form. See Forms. |
orientation | SliderOrientationTypeSliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
pageValue | number | How far PageUp and PageDown move the value. Defaults to ten times step.An assignment that is not a finite number is ignored, and pageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
rateLimitDelay | numberdefault 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and rateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
sinkDutyCycle | numberdefault 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
size | SizeTypeSize.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
softDisabled | booleandefault false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
startAriaLabel | string | The start handle's accessible name. The name read is this text followed by "start". |
startAriaValueText | string | The text a screen reader announces for the start handle's value. Unset, it falls back to startLabel, then to the number. |
startLabel | string | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless startAriaLabel is set, and its value text unless startAriaValueText is set. It does not follow startValue. See Value labels. |
startName | string | The name the starting value submits under. Falls back to name, so a range with only name submits both values under it, start first. See Forms. |
startValue | number | The start handle's value. It cannot pass endValue less minValueGap. Unset, it is a third of the way from min to max.An assignment that is not a finite number is ignored, and startValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
step | numberdefault 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
tickmarks | SliderTickmarkTypeSliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the track-background slot is filled. See Tickmarks. |
touchTarget | TouchTargetTypeTouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Slots
| Slot | Description |
|---|---|
track-background | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Events
| Event | Type | Description |
|---|---|---|
input | RangeTrackControlInputEvent | Fired during interaction. Its detail carries both handle values, as startValue and endValue. It bubbles and is composed. Its detail carries originalEvent. |
change | RangeTrackControlChangeEvent | Fired when interaction ends or based on changeMode. Its detail carries both handle values, as startValue and endValue. It bubbles. Its detail carries originalEvent. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Props
| Prop | Type | Description |
|---|---|---|
ariaDescribedBy | string | The IDs of the elements that describe the control, space-separated. An element elsewhere on the page is not found. |
ariaDescription | string | Not announced by assistive technology. ariaDescribedBy is no substitute: an ID elsewhere on the page is not found. |
ariaErrorMessage | string | The ID of the element describing the value's error. Used only while ariaInvalid is "true". |
ariaInvalid | string | Whether the control's value is invalid. A screen reader announces it; the control's appearance does not change. |
ariaLabelledBy | string | The IDs of the elements that label the control, space-separated. An element elsewhere on the page is not found: use aria-label. |
asyncSink | ValueChangeSink | The async work, such as a request to a server, that ChangeEventMode.Adaptive paces change events against: the control asks for the next one only when the last has finished, no faster than rateLimitDelay. A slow sink is asked less often, and is not called once per value change. Read the control's value inside it, as a change listener would. Ignored in every other mode. See Change mode. |
changeMode | ChangeEventModeTypeChangeEventMode.Debounced, .Immediate, .InteractionEnded, .Throttled, .Adaptivedefault ChangeEventMode.InteractionEnded | When the control fires change while the user is still moving it. Debounced, Throttled and Adaptive are paced by rateLimitDelay, which Adaptive treats as a target, and Adaptive also paces against asyncSink. See Change mode. |
disabled | boolean | Whether the element is disabled. Also reads true while a disabled <fieldset> contains it. See Disabled. |
endAriaLabel | string | The end handle's accessible name. The name read is this text followed by "end". |
endAriaValueText | string | The text a screen reader announces for the end handle's value. Unset, it falls back to endLabel, then to the number. |
endLabel | string | Fixed text that replaces the end value's number in its value label. It is also the end handle's accessible name unless endAriaLabel is set, and its value text unless endAriaValueText is set. It does not follow endValue. See Value labels. |
endName | string | The name the ending value submits under. Falls back to startName. See Forms. |
endValue | number | The end handle's value. It cannot fall below startValue plus minValueGap. Unset, it is two thirds of the way from min to max.An assignment that is not a finite number is ignored, and endValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
labeled | booleandefault false | Whether a label with the handle's value appears while the handle is pressed or focused. It stays briefly after a press ends. See Value labels. |
max | numberdefault 100 | The highest value the range can take. If min is not below it, min becomes max less 1.An assignment that is not a finite number is ignored, and max keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
min | numberdefault 0 | The lowest value the range can take. A minimum that is not below max is replaced by max less 1.An assignment that is not a finite number is ignored, and min keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap. |
minValueGap | number | The least distance between the two handles, in the control's value units. Without it the handles can meet but never cross.An assignment that is not a finite number is ignored, and minValueGap keeps the value it already had. Assigning null or undefined unsets it, removing the gap constraint. See Range and gap. |
name | string | The name the element's value is submitted under with its form. See Forms. |
orientation | SliderOrientationTypeSliderOrientation.Horizontal, .Verticaldefault SliderOrientation.Horizontal | Sets whether the slider runs horizontally or vertically. It is at least 200px long either way. See Orientation. |
pageValue | number | How far PageUp and PageDown move the value. Defaults to ten times step.An assignment that is not a finite number is ignored, and pageValue keeps the value it already had. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
rateLimitDelay | numberdefault 150 | The delay in milliseconds that paces change events in the Debounced, Throttled and Adaptive change modes. Other modes ignore it.An assignment that is not a finite number is ignored, and rateLimitDelay keeps the value it already had. null and undefined are ignored on the same rule. See Change mode. |
sinkDutyCycle | numberdefault 1 | The share of the sink's time this control may occupy, above 0 and up to 1, for ChangeEventMode.Adaptive only. At 1 the next call goes out as soon as the last one finishes. Lower it when the sink is shared, so one person dragging does not saturate it: at 0.25 the control leaves three quarters of the time idle.An assignment that is not a finite number in (0, 1] is ignored, and the property keeps the value it already had. See Change mode. |
size | SizeTypeSize.ExtraSmall, .Small, .Medium, .Large, .ExtraLargedefault Size.ExtraSmall, from the style configuration | Sets how large the component is, from extra-small to extra-large. A larger size makes it taller. See Size. |
softDisabled | booleandefault false | Disables the control but keeps it focusable and in the Tab order. It carries aria-disabled="true", and neither the pointer nor the keyboard changes its value. Use it when a disabled control must stay reachable by keyboard and screen reader. For when this is needed, see WAI-ARIA Authoring Practices: disabled controls. |
startAriaLabel | string | The start handle's accessible name. The name read is this text followed by "start". |
startAriaValueText | string | The text a screen reader announces for the start handle's value. Unset, it falls back to startLabel, then to the number. |
startLabel | string | Fixed text that replaces the start value's number in its value label. It is also the start handle's accessible name unless startAriaLabel is set, and its value text unless startAriaValueText is set. It does not follow startValue. See Value labels. |
startName | string | The name the starting value submits under. Falls back to name, so a range with only name submits both values under it, start first. See Forms. |
startValue | number | The start handle's value. It cannot pass endValue less minValueGap. Unset, it is a third of the way from min to max.An assignment that is not a finite number is ignored, and startValue keeps the last valid value it held. Assigning null or undefined unsets it, restoring the default. See Range and gap. |
step | numberdefault 1 | The step between values. Where the control has a range, a step above the range is set to the range, and a step of 0 or less to 1.An assignment that is not a finite number is ignored, and step keeps the value it already had. null and undefined are ignored on the same rule. See Range and gap, Tickmarks. |
tickmarks | SliderTickmarkTypeSliderTickmark.None, .ContrastEndStop, .Valuesdefault SliderTickmark.ContrastEndStop | The type of tickmarks to show. Ignored while the trackBackgroundSnippet snippet is filled. See Tickmarks. |
touchTarget | TouchTargetTypeTouchTarget.None, .Overflow, .Wrapperdefault TouchTarget.Overflow, from the style configuration | The area that takes a touch, at least 48 by 48 pixels and centered on the component. overflow extends it past the component without changing the component's layout size, wrapper makes the component take up the whole area in the layout, and none limits it to the component's own size. See Size. |
Snippets
| Snippet | Description |
|---|---|
trackBackgroundSnippet | Content that shows through the slider's track in place of its colors. Tickmarks and the end stop are not drawn while it is filled. |
Events
| Prop | Type | Description |
|---|---|---|
onInput | RangeTrackControlInputEvent | Fired during interaction. Its detail carries both handle values, as startValue and endValue. It bubbles and is composed. Its detail carries originalEvent. |
onChange | RangeTrackControlChangeEvent | Fired when interaction ends or based on changeMode. Its detail carries both handle values, as startValue and endValue. It bubbles. Its detail carries originalEvent. |
change fires only when a value differs from the last one sent, and setting start-valueend-value
Each attribute value has its own tokens; a cell shows its token's value, and selecting the cell shows the token's fallback path, with each name and value ready to copy. For example, the extra-small column's handle-length row is --ct-slider-xsmall-handle-length, which defaults to 44px.
Size
Token names spell extra-small as xsmall and extra-large as xlarge.
| Name | extra-small | small | medium | large | extra-large |
|---|---|---|---|---|---|
handle-length | 44px --ct-slider-xsmall-handle-length | 44px --ct-slider-small-handle-length | 44px --ct-slider-medium-handle-length | 68px --ct-slider-large-handle-length | 108px --ct-slider-xlarge-handle-length |
track-corner-end-end-radius | same as track-corner-radius --ct-slider-xsmall-track-corner-end-end-radius | same as track-corner-radius --ct-slider-small-track-corner-end-end-radius | same as track-corner-radius --ct-slider-medium-track-corner-end-end-radius | same as track-corner-radius --ct-slider-large-track-corner-end-end-radius | same as track-corner-radius --ct-slider-xlarge-track-corner-end-end-radius |
track-corner-end-start-radius | same as track-corner-radius --ct-slider-xsmall-track-corner-end-start-radius | same as track-corner-radius --ct-slider-small-track-corner-end-start-radius | same as track-corner-radius --ct-slider-medium-track-corner-end-start-radius | same as track-corner-radius --ct-slider-large-track-corner-end-start-radius | same as track-corner-radius --ct-slider-xlarge-track-corner-end-start-radius |
track-corner-radius | 8px --ct-slider-xsmall-track-corner-radius | 8px --ct-slider-small-track-corner-radius | 12px --ct-slider-medium-track-corner-radius | 16px --ct-slider-large-track-corner-radius | 28px --ct-slider-xlarge-track-corner-radius |
track-corner-start-end-radius | same as track-corner-radius --ct-slider-xsmall-track-corner-start-end-radius | same as track-corner-radius --ct-slider-small-track-corner-start-end-radius | same as track-corner-radius --ct-slider-medium-track-corner-start-end-radius | same as track-corner-radius --ct-slider-large-track-corner-start-end-radius | same as track-corner-radius --ct-slider-xlarge-track-corner-start-end-radius |
track-corner-start-start-radius | same as track-corner-radius --ct-slider-xsmall-track-corner-start-start-radius | same as track-corner-radius --ct-slider-small-track-corner-start-start-radius | same as track-corner-radius --ct-slider-medium-track-corner-start-start-radius | same as track-corner-radius --ct-slider-large-track-corner-start-start-radius | same as track-corner-radius --ct-slider-xlarge-track-corner-start-start-radius |
track-thickness | 16px --ct-slider-xsmall-track-thickness | 24px --ct-slider-small-track-thickness | 40px --ct-slider-medium-track-thickness | 56px --ct-slider-large-track-thickness | 96px --ct-slider-xlarge-track-thickness |
Other tokens
These stay the same whatever the size.
| Token | Value |
|---|---|
--ct-slider-active-handle-space | 5px --ct-slider-active-handle-space |
--ct-slider-active-handle-width | 2px --ct-slider-active-handle-width |
--ct-slider-active-tick-mark-color | --ct-sys-color-on-primary --ct-slider-active-tick-mark-color |
--ct-slider-active-tick-mark-opacity | 1 --ct-slider-active-tick-mark-opacity |
--ct-slider-active-track-color | --ct-sys-color-primary --ct-slider-active-track-color |
--ct-slider-center-space | 4px --ct-slider-center-space |
--ct-slider-disabled-active-tick-mark-color | --ct-sys-color-inverse-on-surface --ct-slider-disabled-active-tick-mark-color |
--ct-slider-disabled-active-track-color | --ct-sys-color-on-surface --ct-slider-disabled-active-track-color |
--ct-slider-disabled-active-track-opacity | 0.38 --ct-slider-disabled-active-track-opacity |
--ct-slider-disabled-handle-color | --ct-sys-color-on-surface --ct-slider-disabled-handle-color |
--ct-slider-disabled-handle-opacity | 0.38 --ct-slider-disabled-handle-opacity |
--ct-slider-disabled-inactive-tick-mark-color | --ct-sys-color-on-surface --ct-slider-disabled-inactive-tick-mark-color |
--ct-slider-disabled-inactive-track-color | --ct-sys-color-on-surface --ct-slider-disabled-inactive-track-color |
--ct-slider-disabled-inactive-track-opacity | 0.12 --ct-slider-disabled-inactive-track-opacity |
--ct-slider-disabled-tick-mark-opacity | 0.38 --ct-slider-disabled-tick-mark-opacity |
--ct-slider-handle-color | --ct-sys-color-primary --ct-slider-handle-color |
--ct-slider-handle-space | 6px --ct-slider-handle-space |
--ct-slider-handle-width | 4px --ct-slider-handle-width |
--ct-slider-inactive-tick-mark-color | --ct-sys-color-on-secondary-container --ct-slider-inactive-tick-mark-color |
--ct-slider-inactive-tick-mark-opacity | 1 --ct-slider-inactive-tick-mark-opacity |
--ct-slider-inactive-track-color | --ct-sys-color-secondary-container --ct-slider-inactive-track-color |
--ct-slider-tick-mark-size | 4px --ct-slider-tick-mark-size |
--ct-slider-value-indicator-block-space | 12px --ct-slider-value-indicator-block-space |
--ct-slider-value-indicator-container-color | --ct-sys-color-inverse-surface --ct-slider-value-indicator-container-color |
--ct-slider-value-indicator-inline-space | 16px --ct-slider-value-indicator-inline-space |
--ct-slider-value-indicator-label-font | --ct-sys-typescale-label-large-font --ct-slider-value-indicator-label-font |
--ct-slider-value-indicator-label-line-height | --ct-sys-typescale-label-large-line-height --ct-slider-value-indicator-label-line-height |
--ct-slider-value-indicator-label-size | --ct-sys-typescale-label-large-size --ct-slider-value-indicator-label-size |
--ct-slider-value-indicator-label-text-color | --ct-sys-color-inverse-on-surface --ct-slider-value-indicator-label-text-color |
--ct-slider-value-indicator-label-tracking | --ct-sys-typescale-label-large-tracking --ct-slider-value-indicator-label-tracking |
--ct-slider-value-indicator-label-weight | --ct-sys-typescale-label-large-weight --ct-slider-value-indicator-label-weight |
Names and states
A range slider has two handles, and each is announced as a slider, following the WAI-ARIA Authoring Practices: Slider pattern.
- Name each handle with
andstart-aria-label . The name read out is that text followed by "start" or "end". Without it, the handle takesend-aria-label orstart-label , and without those, its current number, which is a poor name.end-label - An
aria-labelon the range slider itself is not announced. Use the per-handle properties instead. andstart-aria-valuetext set what is read for the value. Without them, a handle reads its label text, then its number.end-aria-valuetext- Each handle announces its own limits: the start handle's maximum is the end value, and the end handle's minimum is the start value, so neither announces a position it cannot reach.
,aria-labelledby ,aria-describedby , andaria-invalid apply to both handles. An ID that points to an element elsewhere on the page is not found.aria-errormessage is not announced, andaria-description is no substitute, since it cannot point at an element elsewhere on the page.aria-describedby- Each handle announces its orientation from
.orientation - The value label from
is announced politely while it shows.labeled - When one value matters more than a range, choose a Slider.
Keyboard and focus
| Key | Action |
|---|---|
| Tab | Moves focus to the start handle, then the end handle. |
| Shift+Tab | Moves focus back, from the end handle to the start handle. |
| Right Arrow, Up Arrow | Increases the focused handle's value by step |
| Left Arrow, Down Arrow | Decreases the focused handle's value by step |
| Page Up | Increases the value by page-valuestep |
| Page Down | Decreases the value by page-value |
| Home | Moves the handle toward minmin-value-gap |
| End | Moves the handle toward maxmin-value-gap |
The range slider ignores keys while a pointer drag is in progress.
- Each handle draws a focus ring on keyboard focus, on the handle only.
removes both handles from the Tab order.disabled- In a right-to-left layout, Right Arrow and Page Up decrease the value, and Left Arrow and Page Down increase it. Up Arrow and Down Arrow do not change.
Pointer and touch
offerstouch-target ,none andoverflow . Material's touch target is 48 by 48 pixels; WCAG 2.5.8 asks for 24 by 24. The default meets both, and Size shows each choice.wrapper reduces the target to the visible track and handle. Check that size against the 24 by 24 pixel minimum before choosing it.none
Display settings
- Forced colors: each handle and value label take system colors with visible borders, and a handle gains a thicker ring on hover and while dragged.
- Reduced motion: the handle, value label, focus ring, and fill transitions are turned off.
- Right-to-left: the track mirrors, and the arrow keys and Page Up and Page Down swap as the keyboard table says.
Standards
With its defaults, the range slider meets three WCAG 2.2 success criteria:
Three more depend on how you use it:
- 2.5.3 Label in Name (A): where visible text labels the range, start each handle's name with the same words.
- 3.3.1 Error Identification (A): when the range is invalid, set
and pointaria-invalid at text that says what is wrong.aria-errormessage - 4.1.2 Name, Role, Value (A): set
andstart-aria-label so each handle has a name that says what it measures.end-aria-label