- style
Slider
- 1 Description
- 2 Types
- 3 Usage & Behavior
- 3.1 General guidelines
- 3.1.1 Structure
- 3.1.2 Default State
- 3.1.3 Content
- 3.2 States
- 3.3 Interaction
- 3.4 Validations and errors
- 3.5 Best practices
- 3.1 General guidelines
- 4 Range Slider
- 4.1 Usage & Behavior
- 5 Accessibility compliance
- 5.1 Focus management
- 6 Design
- 7 Code
Description
Sliders allow users to select a value from a predefined range.
Types
Type | Usage | Image |
---|---|---|
Single-value slider | Use to select a single value from a predefined range. | |
Range slider | Use to select a range of values, within minimum and maximum values. See Range Slider below. |
Usage & Behavior
General guidelines
Sliders may appear in forms, Dialogs, Filter Panels, or Widgets.
The set of values can be either discrete or continuous, depending on the number of values (see Structure below).
Structure
A slider consists of:
an axis, representing the range of values.
In most cases the axis will be horizontal, but it can also be vertical.
The left (or bottom) area of the axis will be colored, to indicate the selected value.
a handle, which a user can drag in order to select a value.
an Increase button at the right (or top) end of the slider. If the handle is already at the right (or top) end of the slider, the Increase button will be disabled.
a Decrease button at the left (or bottom) end of the slider. If the handle is already at the left (or bottom) end of the slider, the Decrease button will be disabled.
In case of a discrete set of values a set of tick marks will appear, indicating the possible values.
The slider may also include:
A set of values, ordered from minimum to maximum, for all or some of the values.
For numeric values - a supplemental text field allowing the user to view the selected value and to change it manually.
When dragging - a tooltip on top (or to the side) of the handle, showing the relevant value:
Default State
A slider must have a default value. Usually it is the most common or popular value.
Content
In most cases, values will be numbers with a fixed increment between them (e.g. 1, 2, 3… or 5, 10, 15, 20…).
Alternatively, values can be textual (e.g. Poor, Fair, Average, Good, Excellent) or icon-based (e.g. sentiment indicators).
States
State | Image | Comment |
---|---|---|
Normal |
| |
Hover |
| |
Active |
| |
Disabled |
| |
Focused |
| |
Focused Hover |
| |
Focused Active |
| |
Focused Disabled |
| |
Warning |
|
|
Interaction
Hovering the slider will show the current value in a tooltip above (or to the side of) the selected value.
The user can select a value using one of these methods:
Dragging the handle to the desired position (see Drag and Drop). In this case:
If ticks exist, the movement of the handle across the axis will be discrete, along the tick marks.
If no ticks exist, the movement will be continuous.
If a text field exists, the value will be updated automatically.
a tooltip may appear, showing the value
Clicking on the axis itself. In this case the handle will move to the selected position.
Clicking the increase or decrease buttons. In this case:
The handle will move to the the next / previous position respectively.
If a text field exists, the value will be updated automatically.
Entering a value in the text field, if one exists. In this case, the handle will automatically move to the relevant position on the axis after moving the focus away from the text field.
Using the mouse wheel when the slider is selected. In this case, the handle will move to the relevant position on the axis and the value will be updated automatically.
Validations and errors
The slider itself has no error state.
A warning state may be triggered when exceeding certain values (optional, see design above)
If a text field exists, typing out of range values or illegal characters will show an error message. See Field Validation. In this case, the handle will remain at its position until entering a valid value.
Best practices
Use when:
Values have a distinct order.
There is a default value.
There are at least three possible values.
Don’t use:
If one or more of the conditions above is not met → use Radio Buttons or a Drop-down Menu.
For selecting dates → use a Date Picker or Range Picker instead.
Range Slider
Basic range slider | |
Range slider with input fields |
A range slider is a variant of the slider, allowing users to select a range of values within the total range.
Usage & Behavior
The slider includes two handles, for the minimum and maximum values.
The area of the axis between the two handles will be colored, to indicate the selected range.
The slider will not include the Increase and Decrease buttons.
The slider may include:
Two input fields: one for the minimum value and one for the maximum value.
A tooltip when dragging - one tooltip for the entire range.
Dragging a handle will be limited by the other handle or by a minimum valid range.
Accessibility compliance
In the Focus stated for a single-value slider, if a supplementary text field exists, typing will enter/update the value.
Unless otherwise specified, see our general compliance information in Fundamentals - Accessibility.
Focus management
Keyboard | Single selector | Range selector |
---|---|---|
| ||
Tab | Navigates to the next component. | Without input fields:
With input fields:
|
Shift + Tab | Navigates to the previous component. | Without input fields:
With input fields:
|
Space | N/A | N/A |
Enter | N/A | N/A |
Esc | N/A | N/A |
Arrows | Up/Down or Left/Right - Increases or decreases the value accordingly. | Up/Down or Left/Right - Increases or decreases the value accordingly. |
Page Up | Increases the slider value by multiple steps, e.g. by ten steps. | Increases the slider value by multiple steps, e.g. by ten steps. |
Page Down | Decreases the slider value by multiple steps, e.g. by ten steps. | Decreases the slider value by multiple steps, e.g. by ten steps. |
Home | Sets slider to its minimum value. | Sets slider to its minimum value. |
End | Sets slider to its maximum value. | Sets slider to its maximum value. |
Design
Zeplin link | Screen thumbnail |
---|---|
Code