Slider
Slider
- HTML/CSS:Dev Ready
- Layout:Responsive
An input range slider lets the user specify a numeric value which must be between two specified values.
Base
Preview
About Slider
The slider component is built using a native input form element with the attribute type of "range".
Implementation Notes and Requirements
slds-slidershould be applied to the div containing both the<input>and the<span>that holds the value of the<input>slds-slider__rangeshould be applied to the<input>element- The
<input>should have a unique ID that matches theforattribute on the form element<label>
- The
- The
slds-slider__rangeelement can accept 4 atrributes that describe the input range:- value: Current value of the input range
- min: Minimum value of a specified range
- max: Maximum value of a specified range
- step: Indicates the granularity that is expected by limiting the allowed values
- The
slds-slider__valuespan should be updated with the current value of the<input> - The
slds-slider__valueelement must havearia-hidden=trueto hide from screen readers as they understand that value already from the<input> - The class
slds-assistive-textcan be placed on the<label>, or either<span>within the<label>, to visually hide the either value (or both).
Overview of CSS Classes
- Selector
- The CSS class being referred to.
- Summary
- A description of what the class does.
- Support
- Whether the class name is dev-ready (meaning it's fully vetted and tested and safe to use) or prototype (which means it's not fully vetted yet).
- Restrict
- The selector that the class name is allowed to be used on.
- Variant
- The base level pattern for a component. A variant can be extended to create another variant of that component, for example, a stateful button is a derivative of the base button.
- Modifier
- A single class that can be added to an HTML element of a component to modify its output. Typically these will be colors, sizing and positioning.
| Selector | .slds-slider |
|---|---|
| Summary | Initializes slider component |
| Support | dev-ready |
| Restrict | div |
| Variant | True |
| Selector | .slds-slider__value |
|---|---|
| Summary | Element that contains value of input range |
| Restrict | .slds-slider span |
| Selector | .slds-slider_vertical |
|---|---|
| Summary | Modifier that makes the slider vertical |
| Restrict | .slds-slider |
| Modifier | True |