---
title: "Elastic Slider"
description: "A slider whose track stretches past its ends and springs back when you let go. It has a value tag that sways, marks that hold the thumb, and end icons."
url: https://gelatinui.com/components/elastic-slider
markdown_url: https://gelatinui.com/components/elastic-slider.md
access: free
install: "npx shadcn@latest add @gelatin-ui/elastic-slider"
registry_item: https://gelatinui.com/r/elastic-slider.json
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Elastic Slider

> A slider whose track stretches past its ends and springs back when you let go. It has a value tag that sways, marks that hold the thumb, and end icons.

Page: https://gelatinui.com/components/elastic-slider

## When to use it

Best for: A volume or a level that should feel physical: the track stretches past its ends and springs back.

- Use it for a volume, a brightness, or a level where a playful feel fits the app.
- Use `tooltip` to show the value over the thumb while people drag or use the keys.
- Use `marks` with labels for named steps, such as text sizes or speeds.
- Use `ElasticSliderStartIcon` and `ElasticSliderEndIcon` for icons at the ends, such as quiet and loud.

## When not to use it

- For a plain form value with no motion, use a [Slider](https://gelatinui.com/components/slider.md).
- For an angle or a zoom on a moving scale, use a [Ruler Slider](https://gelatinui.com/components/ruler-slider.md).
- For a number in a dense settings panel, use a [Scrub Slider](https://gelatinui.com/components/scrub-slider.md).

## Notes for agents

- It takes every Slider prop except `variant`, and puts its children above the control (a `SliderLabel`, a `SliderValue`).
- `elastic` is on by default. Set `elastic={false}` for a still track with the same tag and marks.
- `tooltip`: `true` shows the tag on hover, on keyboard focus, and while dragging; `"always"` keeps it shown.
- While a tag shows, the `SliderValue` fades out, so one value is on screen. Leave room above the track for the tag.
- `marks` takes numbers or `{ value, label }`. A drag holds on a mark for 6px; a press on a label sets its value.
- With no `SliderLabel`, pass `thumbProps={{ "aria-label": "Volume" }}`.
- For a row layout, give the root `flex-row items-center` and put `order-last` on the `SliderValue`.

## Anatomy

```text
ElasticSlider
├─ ElasticSliderControl (0..n)
├─ ElasticSliderTrack (0..n)
├─ ElasticSliderThumb (0..n)
├─ ElasticSliderMarks (0..n)
├─ ElasticSliderMarkLabels (0..n)
└─ ElasticSliderThumbTooltip (0..n)
```

## API reference

### ElasticSlider

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `control` | `ReactNode` |  | The control under the children. Default: a `SliderControl` with the track, the indicator, and one thumb per value. Pass your own `SliderControl` to change a part (a thumb with a Tooltip). |
| `thumbProps` | `Omit<SliderThumbProps, "index">` |  | Props for every default thumb: `getAriaLabel`, `getAriaValueText`, `aria-label`, `disabled`. |
| `tone` | `TrackTone` |  | `default`: the `primary` fill. A status colors the fill and the thumb edge: `success` a good value, `warning` a value that needs care, `info` a neutral mark, `destructive` a value over a limit. Color is never the only signal: say it in words too. |
| `glow` | `boolean` |  | A soft halo in the fill color (`glow`, `@gelatin-ui/glow`). Default: `false`. |
| `elastic` | `boolean` | true | The rubber track: a press swells the active thumb and thickens the track, a drag past an end stretches the track with resistance, and the release springs back with one wobble. Home or End at a limit bumps the track. Default `true`. |
| `tooltip` | `"always" \| boolean` | false | A value tag over each thumb (`ElasticSliderThumbTooltip`). `true`: it shows on hover, on keyboard focus, and while dragging, and sways with the drag speed. `"always"`: it always shows. A `SliderValue` fades out while a tag shows, so one value is on screen. Default `false`. |
| `marks` | `readonly (number \| Readonly` |  | Marks on the track: values, or `{ value, label }` with a label under the track. A drag holds on a mark for 6px (a detent) and a ring pops from the thumb; a press on a label sets its value. Keys and track presses step past marks. Made for `thumbAlignment="center"` (the default). |

Also takes every prop of Base UI `Slider.Root`: https://base-ui.com/react/components/slider

### ElasticSliderStartIcon

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### ElasticSliderEndIcon

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### ElasticSliderControl

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ElasticSliderTrack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ElasticSliderThumb

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Slider.Thumb`: https://base-ui.com/react/components/slider

### ElasticSliderMarks

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ElasticSliderMarkLabels

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### ElasticSliderThumbTooltip

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `index` | `number` |  | The thumb whose value the tag shows. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ElasticSlider | `elastic-slider` | `data-covers-label` | `--slider-label-opacity`, `--slider-value-opacity` |  |
| ElasticSliderControl | `elastic-slider-control` | `data-orientation` |  |  |
| ElasticSliderTrack | `elastic-slider-track` | `data-orientation` | `--slider-pull-a`, `--slider-stretch-cross`, `--slider-stretch-main` |  |
| ElasticSliderThumb | `elastic-slider-thumb` | `data-orientation` | `--slider-pop`, `--slider-stretch-cross`, `--slider-stretch-main`, `--slider-swell`, `--slider-thumb-pop`, `--slider-thumb-swell` |  |
| ElasticSliderMarks | `elastic-slider-marks` | `data-filled` | `--slider-mark`, `--slider-stretch-cross`, `--slider-stretch-main` | `motion-timing` |
| ElasticSliderMarkLabels | `elastic-slider-mark-labels` | `data-current`, `data-disabled` | `--slider-mark` | `motion-timing` |
| ElasticSliderThumbTooltip | `elastic-slider-thumb-tooltip` |  | `--slider-thumb-swell` |  |

## Usage

Children go above the track. Add the end icons as parts, and `tooltip` for the value tag.

```tsx title="volume-slider.tsx"
import { SpeakerHighIcon, SpeakerLowIcon } from "@phosphor-icons/react/ssr";

import {
  ElasticSlider,
  ElasticSliderEndIcon,
  ElasticSliderStartIcon,
} from "@/components/ui/elastic-slider";
import { SliderLabel, SliderValue } from "@/components/ui/slider";

export function VolumeSlider() {
  return (
    <ElasticSlider defaultValue={42} tooltip format={{ style: "unit", unit: "percent" }}>
      <ElasticSliderStartIcon>
        <SpeakerLowIcon />
      </ElasticSliderStartIcon>
      <ElasticSliderEndIcon>
        <SpeakerHighIcon />
      </ElasticSliderEndIcon>
      <div className="flex items-center justify-between gap-2">
        <SliderLabel>Volume</SliderLabel>
        <SliderValue />
      </div>
    </ElasticSlider>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/elastic-slider
```

It adds 34 registry items: 30 files, 5904 lines, and the npm packages `@base-ui/react`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Slider](https://gelatinui.com/components/slider.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Slider](https://gelatinui.com/components/slider.md)
- [Ruler Slider](https://gelatinui.com/components/ruler-slider.md)
- [Scrub Slider](https://gelatinui.com/components/scrub-slider.md)
- [Toggle](https://gelatinui.com/components/toggle.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow keys | Changes the value by one `step`. |
| Shift + arrow keys, Page Up, Page Down | Changes the value by `largeStep`. |
| Home, End | Goes to the minimum or the maximum. At a limit, the track bumps. |

## Accessibility

Each thumb is a native range input, so the keys step the value and a form can read it.

The value tag, the mark dots, the mark labels, and the end icons are `aria-hidden`: the thumb says the value.

A press on an end icon or the gap next to the track does nothing.

## Motion

| Part | Motion |
| --- | --- |
| Press | statusPop · a press on the track swells the thumb and thickens the track |
| Stretch | elastic · a drag past an end stretches the track up to 24px, then it springs back with one wobble |
| Bump | elastic · Home, End, or an arrow at a limit bumps the track about 8px |
| Value tag | sway · the tag tilts with the drag speed, up to 12°, and swings back once |
| Tag in and out | statusPop · the tag pops in from 60%, and goes out on fadeExit |
| Mark | indicator · a ring pops from the thumb when a drag reaches a mark |
