Hone UI
Components

Slider

Pick a value or a range by dragging along a rail.

Slider picks a number, or a range with two thumbs, between min and max.

import Slider from '@hone-ui/react/Slider';

Examples

<Box sx={{ display: 'grid', gap: 4, p: 2, maxWidth: 320 }}>
  <Slider aria-label="Volume" defaultValue={30} />
  <Slider
    aria-label="Price"
    defaultValue={[20, 60]}
    valueLabelDisplay="on"
    marks={[
      { value: 0, label: '$0' },
      { value: 100, label: '$100' },
    ]}
  />
</Box>

Props

PropTypeDefaultDescription
value, defaultValuenumber, number[]minAn array makes a range slider.
onChange(event, value, activeThumb) => voidWhile the value changes.
onChangeCommitted(event, value) => voidWhen the user lets go.
min, max, stepnumber0, 100, 1The range and step.
marksboolean, { value, label }[]falseMarks on the rail.
valueLabelDisplay'on', 'auto', 'off''off'The value bubble over the thumb.
valueLabelFormatstring, (value, index) => nodeThe bubble's text.
orientation'horizontal', 'vertical''horizontal'The direction of the rail.
colorpalette key'primary'Track and thumb color.
size'small', 'medium''medium'The size.
track'normal', 'inverted', false'normal'How the filled part shows.
disabled, nameStandard.
getAriaLabel, getAriaValueTextfunctionsNames and value text for each thumb.
sx, className, style, refStandard.

Notes

  • step={null}, scale, shiftStep and disableSwap are not supported.

Accessibility

Each thumb is a native range input with arrow, Page and Home/End keys. Name every thumb with aria-label, aria-labelledby or getAriaLabel.

On this page