Skip to content

Slider - Frameworks

Sliders allow users to adjust a numeric value within a given range.

AndroidreleasediOSreleasedReactreleasedReact 19releasedVuereleased

React

Import

You can import the component like so:

js
import { Slider } from '@warp-ds/react';

or import it individually to optimize your JS bundle size by adding only the components you need:

js
import { Slider } from '@warp-ds/react/components/slider'

Examples

Enabled

js
function Example() {
  const [value, setValue] = React.useState(2_500_000);

  return (
    <div>
      <output>{value}</output>
      <Slider
        onChange={(value) => setValue(value)}
        value={value}
        min={1000}
        max={10_000_000}
        step={1000}
      />
    </div>
  );
}

Disabled

jsx
<div>
  <Slider aria-label="Disabled slider" value={50} disabled />
</div>

Props

Required props

NameTypeDefaultDescription
stepnumberSpecifies the value granularity
valuenumberThe current value

Optional Props

NameTypeDefaultDescription
maxnumber100The greatest value in the range of permitted values
minnumberThe lowest value in the range of permitted values
disabledbooleanWhether the slider is disabled
aria-labelnumberString value for aria-label
aria-labelledbystringIdentifies the element that labels the slider
aria-valuetextstringHuman readable text alternative for the value

Events

NameDescription
onChange(value: number) => void

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system