Slider
Sliders allow users to select a range of data points. They’re useful for dynamic filtering, or selecting a specific value from a predefined range of values.
Example
Usage
Sliders are available in two basic kind
: single
(single value) and range
(range select).
- You must specify the
value
, its type can be number forsingle
or [number, number] forrange
. - You can use
onChange
event as a callback to update thevalue
.
Variants
Disabled
The slider can be disabled by adding prop disabled
to the component.
Label
The slider can be used together with a label and an info tooltip by adding the props label
and labelIconTooltip
to the component.
Legend
The slider can be used with Legend to display the selected value(s) and there are two usages:
- To display the selected value(s) only, you can add the prop
hasLegend
(boolean) to the component. - To display the selected value(s) with a symbol, you can add the prop
hasLegendWith
([string, 'left' | 'right']) to the component and specify the position of the symbol.
Min & Max
The slider can specify the maximum value allowed as well as the minimum value allowed by adding props max
(default is 100) and min
(default is 0) to the component.
Steps
The slider can have a predefined step interval (eg. a scale of 0 to 10) by adding prop step
to the component, no floating numbers should be selectable.
Props
Name | Type | Default |
---|---|---|
value * The selected value(s) |
| — |
onChange The onChange callback event |
| — |
kind The slider variants, default is single select |
| "single" |
min The minimum value allowed |
| 0 |
max The maximum value allowed |
| 100 |
step The legal number intervals |
| — |
label Allow to display the title of Slider |
| — |
labelIconTooltip The tooltip of icon next to label |
| — |
disabled Allow to disable Slider |
| false |
hasLegend Allow to display the legend with selected value(s) |
| false |
hasLegendWith Allow to display the legend with the symbol on before or after, eg: $10, 20$ |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |