Skip to main content
Kaleidoscope

SliderInput

Useful for easily changing inputs that require a sliding numerical scale

Default

By default all you need to pass is a label:

Editable example

This component is only designed to be used as an uncontrolled component -- we provide a handleValueChange function for convenience to listen to any changes but there's no way to set the value after the initial value has been set.

Theming

Sliders are also usable with a dark background by passing a theme prop:

Editable example

With an initial value

You can provide a custom initial value (default is 25):

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

Unit customisation

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

Editable example

Best practices

  1. Use Sliders for options that require fine granular control over a numeric value, such as opacity
  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.