Skip to main content

Slider Field

type: "slider"

A slider to pick a number within a range, next to a number input to type an exact value. Use it for values with a natural range, like an opacity, a percentage or a size. For numbers without a range, use a number field.

Additional Properties​

PropertyTypeRestrictionsDescription
minnumber-The lowest value of the slider. Defaults to 0.
maxnumber-The highest value of the slider. Defaults to 100.
stepnumberGreater than 0The steps the slider moves in. Defaults to 1.
defaultValuenumber-The value of the field while users haven't set one.

While the field isn't set, the slider shows the defaultValue, or sits at min without one. Users can clear the field with the clear button next to the number input, which brings back the defaultValue.

Example​

mobro-widget-config.json
{
"config": [
{
"name": "opacity",
"label": "Opacity",
"type": "slider",
"min": 0,
"max": 1,
"step": 0.05,
"defaultValue": 1
},
{
"name": "corner_radius",
"label": "Corner radius (px)",
"type": "slider",
"max": 32,
"defaultValue": 8
}
]
}

Usage​

To read the value of this field in a widget, use useSliderField.