Slider¶
A Slider provides a visual indication of adjustable content, where the user can increase or decrease the value by moving the slider thumb along a horizontal track.
Usage¶
Sliders allow users to view and select a value from the range along a horizontal track. They’re ideal for adjusting settings such as volume and brightness where accuracy is not of highest importance.
The buttons can be used to make small adjustments in either direction, while the slider thumb can be used for larger adjustments.
Changes made with sliders take effect immediately, allowing users to make slider adjustments with direct feedback.
When to use¶
- Use it for making selections from a range of values.
- Use it when the range is more important than precision.
Best practices¶
- Use a regular value input, if a user needs to enter a precise number.
- Sliders shouldn’t be used to adjust settings with any delay in providing user feedback.
Design¶
Elements¶
- +/- Button, 2. Thumb, 3. Thumb icon (Optional), 4. Track, 5. Range values (Optional)
Slider variations¶
Thumb interaction states¶
The thumb can optionally contain an icon.
Code¶
Usage¶
import { SiSliderComponent } from '@siemens/element-ng/slider';
@Component({
imports: [SiSliderComponent, ...]
})
SiSliderComponent API Documentation¶
si-slider
Common interface for form item controls. Controls that should be connected to SiFormItemComponent must implement this interface and must be provided using the SI_FORM_ITEM_CONTROL token.
Input Properties¶
Name | Type | Default | Description |
---|---|---|---|
decrementLabel ¶ | TranslatableString | $localize`:@@SI_SLIDER.DECREMENT:Decrement` | Text for aria-label of decrement. Needed for a11y. |
disabled ¶ | boolean | false | |
id ¶ | string | __si-slider-${SiSliderComponent.idCounter++} | |
incrementLabel ¶ | TranslatableString | $localize`:@@SI_SLIDER.INCREMENT:Increment` | Text for aria-label of increment. Needed for a11y. |
labelledby ¶ | string | ${this.id()}-label | |
max ¶ | number | 100 | Maximum of slider range. |
maxLabel ¶ | string | '' | Label to describe maximum of slider range. |
min ¶ | number | 0 | Minimum of slider range. |
minLabel ¶ | string | '' | Label to describe minimum of slider range. |
sliderLabel ¶ | TranslatableString | $localize`:@@SI_SLIDER.LABEL:Value` | Text for aria-label of slider. Needed for a11y |
step ¶ | number | 1 | Interval to step through the slider. |
thumbIcon ¶ | string | Icon to use as the slider thumb. | |
value ¶ | number | Current value of slider. |
Output Properties¶
Name | Type | Description |
---|---|---|
valueChange ¶ | number | Current value of slider. |
Types Documentation¶
Variable |
---|
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit . Equivalent to a normal string in usage and functionality. |
---|
Common interface for form item controls. Controls that should be connected to SiFormItemComponent must implement this interface and must be provided using the SI_FORM_ITEM_CONTROL token. | |||||
---|---|---|---|---|---|
|
Translatable import imported from @siemens/element-translate-ng |
---|
|
Interface for form error mapper. It resolves a key to either a translatable string or function which is called with the validation error for its key and should return a translatable string. | |
---|---|
| |
|
| ||||||||||||
| ||||||||||||
|
| |||||||||||
| |||||||||||
| |||||||||||
|
| ||||||||||||
| ||||||||||||
|
Except where otherwise noted, content on this site is licensed under MIT License.