# Slider: Range

> Pass two values for a range. Name each thumb with `getAriaLabel`, and keep them apart with `minStepsBetweenValues`. With `draggableRange`, drag anywhere between the thumbs to move both at once; a tap there still moves the nearest thumb.

Example: https://hextaui.com/docs/slider/examples/range
Component docs: https://hextaui.com/docs/slider.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/slider-range.json
```

This adds `components/examples/slider/range.tsx` with the Slider component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/slider/range.tsx"
"use client"

import { Slider, SliderLabel, SliderValue } from "@/components/ui/slider"

export function SliderRange() {
  return (
    <Slider
      defaultValue={[200, 800]}
      max={1000}
      step={10}
      minStepsBetweenValues={10}
      draggableRange
      format={{ style: "currency", currency: "USD", maximumFractionDigits: 0 }}
      getAriaLabel={(index) =>
        index === 0 ? "Minimum price" : "Maximum price"
      }
      className="max-w-xs"
    >
      <SliderLabel>Price</SliderLabel>
      <SliderValue />
    </Slider>
  )
}
```

## Props in this example

### Slider

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `defaultValue` | `number \| number[]` | – |  |
| `max` | `number` | `100` |  |
| `step` | `number` | `1` |  |
| `minStepsBetweenValues` | `number` | `0` |  |
| `draggableRange` | `boolean` | `false` | In a range, dragging between the thumbs moves them together, keeping the gap. |
| `format` | `Intl.NumberFormatOptions` | – |  |
| `getAriaLabel` | `(index: number) => string` | – | Names each thumb of a range. |
| `className` | `string \| (state) => string` | – |  |

## More Slider examples

- [Sizes](https://hextaui.com/docs/slider/examples/sizes.md)
- [Value bubble](https://hextaui.com/docs/slider/examples/value-bubble.md)
- [Steps and format](https://hextaui.com/docs/slider/examples/steps.md)
- [Controlled](https://hextaui.com/docs/slider/examples/controlled.md)
- [Vertical](https://hextaui.com/docs/slider/examples/vertical.md)
- [With icons](https://hextaui.com/docs/slider/examples/icons.md)
- [Disabled](https://hextaui.com/docs/slider/examples/disabled.md)
- [Long labels](https://hextaui.com/docs/slider/examples/long-label.md)
- [Right to left](https://hextaui.com/docs/slider/examples/rtl.md)
