Properties
Property | Type | Description |
---|---|---|
value | number Array<number> | (required) The value of the slider as a number or an array. If an array with numbers is provided, each number will represent a thumb button (the + and - button will be hidden on multiple thumbs). |
min | number | (optional) The minimum value. Can be a negative number as well. Defaults to 0 . |
max | number | (optional) The maximum value. Defaults to 100 . |
step | number | (optional) The steps the slider takes on changing the value. Defaults to null . |
vertical | boolean | (optional) Show the slider vertically. Defaults to false . |
reverse | boolean | (optional) Show the slider reversed. Defaults to false . |
stretch | boolean | (optional) If set to true , then the slider will be 100% in width . |
hideButtons | boolean | (optional) Removes the helper buttons. Defaults to false . |
multiThumbBehavior | string | (optional) Use either omit , push or swap . This property only works for two (range) or more thumb buttons, while omit will stop the thumb from swapping, push will push its nearest thumb along. Defaults to swap . |
thumbTitle | string | (optional) Give the slider thumb button a title for accessibility reasons. Defaults to null . |
subtractTitle | string | (optional) Give the subtract button a title for accessibility reasons. Defaults to − . |
addTitle | string | (optional) Give the add button a title for accessibility reasons. Defaults to + . |
numberFormat | object | (optional) Will extend the return object with a number property (from onChange event). You can use all the options from the NumberFormat component. It also will use that formatted number in the increase/decrease buttons. If it has to represent a currency, then use e.g. numberFormat={{ currency: true, decimals: 0 }} |
tooltip | boolean | (optional) Use true to show a tooltip on mouseOver , touchStart and focus , showing the current number (if numberFormat is given) or the raw value. |
alwaysShowTooltip | boolean | (optional) Use true to always show the tooltip, in addition to the tooltip property. |
label | string | (optional) Prepends the Form Label component. If no ID is provided, a random ID is created. |
labelDirection | string | (optional) Use labelDirection="vertical" to change the label layout direction. Defaults to horizontal . |
labelSrOnly | boolean | (optional) Use true to make the label only readable by screen readers. |
status | string | (optional) Text with a status message. The style defaults to an error message. You can use true to only get the status color, without a message. |
statusState | string | (optional) Defines the state of the status. Currently, there are two statuses [error, info] . Defaults to error . |
statusProps | object | (optional) Use an object to define additional FormStatus properties. |
globalStatusId | string | (optional) The status_id used for the target GlobalStatus. |
suffix | string | (optional) Text describing the content of the Slider more than the label. You can also send in a React component, so it gets wrapped inside the Slider component. |
skeleton | boolean | (optional) If set to true , an overlaying skeleton with animation will be shown. |
extensions | object | (optional) Makes it possible to display overlays with other functionality such as a marker on the slider marking a given value. |
Space | string object | (optional) Spacing properties like top or bottom are supported. |
Translations
More info about translations can be found in the general localization and Eufemia Forms localization docs.
Key | nb-NO | en-GB | en-US |
---|---|---|---|
Slider.addTitle | Øk (%s) | Increase (%s) | Increase (%s) |
Slider.subtractTitle | Reduser (%s) | Decrease (%s) | Decrease (%s) |
Extensions
A Slider Extension should be an object with the following properties:
import Slider, { SliderMarker } from '@dnb/eufemia/components/Slider'render(<Sliderextensions={{marker: {instance: SliderMarker,value: 50,},}}/>,)