Skip to main content
Kaleidoscope

Slider

Useful for easily changing inputs that require a sliding numerical scale

Default

By default all you need to pass is a label, value, and onChange handler:

Editable example

Theming

Sliders are also usable with a dark background when used in a dark themed context.

Editable example

Min and max values

By default, the minimum is set at 0 and maximum is set at 100. You can also set custom minimum and maximum range values.

Editable example

Step

Step by a custom amount along the slider. By default the step is set to 1.

Editable example

Unit

You can provide a unit prop; for example when using the Slider to set font size:

Editable example

Label hidden

The label and number input can be hidden with the labelHidden prop. The current value wil instead show on hover.

Editable example

Value hidden

To never show the output value, either with the label shown or hidden, use the valueHidden prop.

Editable example

Best practices

  1. Use Sliders for options that benefit from gestural control over a numeric value, such as opacity. For values that require more precision, use a .
  2. Choose a short and descriptive label that describes the value being changed.
  3. If the number value represents a unit of something, always provide a unit label.
  4. Avoid using a Slider for ranges that are extremely large (e.g. 1—1000) or very small (e.g. 1—5).

Accessibility

This component makes use of native HTML form elements, which ensures usability from the keyboard and with screen readers. Always provide a label for screen readers to explain the purpose of the slider.