Slider

Display the current value and an inputable range.

General

Accept clicks or drag actions.

Type

Differentiate states by color.

Disabled

Do not respond to drag and click.

Step

Different granularity.

Range

Specifies the maximum or minimum value of the Slider.

Event

Get event when slide.

Budget

Show the chosen value as text next to the Slider, and set min, max and step to the values that make sense.

APIs

Slider.Props

AttributeDescriptionTypeAccepted valuesDefault
initialValueinitial valuenumber-0
valueslider valuenumber-0
typecurrent typeSliderTypesSliderTypesdefault
stepthe granularity the slider can step through valuesnumber-1
maxthe maximum value of slidernumber-100
minthe minimum value of slidernumber-0
disableddisable slider interactionbooleanfalse
errormark the field as invalidboolean-false
errorMessagemessage below the sliderstring--
showMarkersshow each markerboolean-false
hideValuehide slider valueboolean-false
onChangecalled when the value of silder changes(val: number) => void--
...native propsHTMLAttributes'id', 'name', 'className', ...-

SliderTypes

type SliderTypes =
  | 'default'
  | 'primary'
  | 'secondary'
  | 'success'
  | 'warning'
  | 'error'
  | 'info'

Ref

The ref points at the root element of the slider.

Accessibility

  • • The handle is a slider with aria-valuemin, aria-valuemax and aria-valuenow, and takes the focus with Tab.
  • • Arrows change the value by step, Page Up and Page Down by ten steps, and Home and End go to the minimum and the maximum.
  • • Without a visible label, pass aria-label or aria-labelledby.
Edit this page on GitHub