---
title: "Scrub Slider"
description: "A slider in one row: the label, the value, and the fill behind them. Press to jump, drag to scrub, or double-click the value to type it."
url: https://gelatinui.com/components/scrub-slider
markdown_url: https://gelatinui.com/components/scrub-slider.md
access: free
install: "npx shadcn@latest add @gelatin-ui/scrub-slider"
registry_item: https://gelatinui.com/r/scrub-slider.json
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Scrub Slider

> A slider in one row: the label, the value, and the fill behind them. Press to jump, drag to scrub, or double-click the value to type it.

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

## When to use it

Best for: Many number settings in little space: each row is a label, a value, and a fill to drag.

- Use it in a properties panel, an inspector, or an editor sidebar.
- Use `ScrubSliderGroup` to put rows on one muted panel.
- Use `format` and `locale` for units, such as percent, degrees, or milliseconds.
- Use it when people need both a drag and an exact typed value.

## When not to use it

- For one value in a form with a big track, use a [Slider](https://gelatinui.com/components/slider.md).
- For an exact number with steppers only, use a [Number Field](https://gelatinui.com/components/number-field.md).
- For a value that should feel physical, such as a volume, use an [Elastic Slider](https://gelatinui.com/components/elastic-slider.md).

## Notes for agents

- The children go inside the row: a `ScrubSliderLabel` at the start and a `ScrubSliderValue` at the end.
- A double-click on the value, or Enter on the slider, opens the text edit. Enter or a click away saves, Escape cancels.
- A typed number out of `min`..`max` shows the invalid look, and Enter saves it clamped.
- Ticks show one per `step`, up to 12 spaces; `ticks` sets the count, `ticks={false}` hides them.
- `thumb` picks the look: `bar` (default), `line`, `pill`, `caps`, or `fat`.
- `size` is a row: `sm` 28px, `default` 32px, `lg` 36px. On touch the row is 44px high.
- With no `ScrubSliderLabel`, pass `thumbProps={{ "aria-label": "Radius" }}`.
- `ScrubSliderGroup` is a `fieldset`: give it an `aria-label` or a `legend`.

## Anatomy

```text
ScrubSlider
├─ ScrubSliderControl (0..n)
├─ ScrubSliderTrack (0..n)
├─ ScrubSliderIndicator (0..n)
├─ ScrubSliderTicks (0..n)
├─ ScrubSliderThumb (0..n)
├─ ScrubSliderLabel (0..n)
├─ ScrubSliderValue (0..n)
└─ ScrubSliderGroup (0..n)
```

## API reference

### ScrubSlider

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `size` | `"default" \| "lg" \| "sm"` | "default" |  |
| `thumb` | `"bar" \| "caps" \| "fat" \| "line" \| "pill"` | "bar" | The look of the thumb: `bar` (default), `line`, `pill`, `caps`, or `fat`. |
| `ticks` | `number \| false` |  | The number of spaces between ticks. Default: one tick per `step`, and at most 12 spaces: a finer step thins out to a nice interval (1, 2, 2.5, or 5 × 10ⁿ, kept a whole number of steps). `false` draws no ticks. |
| `control` | `ReactNode` |  | The row, in place of the default: a `ScrubSliderControl` with a `ScrubSliderTrack` and your label and value inside. With it, `children` and `thumbProps` are not used. |
| `thumbProps` | `Omit<ScrubSliderThumbProps, "index">` |  | Props for the default thumb: `getAriaLabel`, `getAriaValueText`, `aria-label`. |

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

### ScrubSliderControl

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

### ScrubSliderTrack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `thumbProps` | `Omit<ScrubSliderThumbProps, "index">` |  | Props for the default thumb. |

### ScrubSliderIndicator

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

### ScrubSliderTicks

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

### ScrubSliderThumb

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

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

### ScrubSliderLabel

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

### ScrubSliderValue

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

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

### ScrubSliderGroup

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

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ScrubSlider | `scrub-slider` | `aria-invalid`, `data-disabled`, `data-dragging`, `data-editing`, `data-focus-visible`, `data-invalid` | `--radius`, `--scrub-slider-progress`, `--scrub-slider-stretch`, `--scrub-slider-stretch-origin`, `--scrub-slider-text-end`, `--scrub-slider-text-start`, `--scrub-slider-tick` | `motion-timing` |
| ScrubSliderControl | `scrub-slider-control` |  |  |  |
| ScrubSliderTrack | `scrub-slider-track` |  |  |  |
| ScrubSliderIndicator | `scrub-slider-indicator` |  |  |  |
| ScrubSliderTicks | `scrub-slider-ticks` |  | `--scrub-slider-tick` |  |
| ScrubSliderThumb | `scrub-slider-thumb` |  |  |  |
| ScrubSliderLabel | `scrub-slider-label` |  |  |  |
| ScrubSliderValue | `scrub-slider-value` |  |  |  |
| ScrubSliderGroup | `scrub-slider-group` | `data-size` | `--radius` |  |

## Usage

Put the label and the value inside the row. Use `ScrubSliderGroup` for a panel of rows.

```tsx title="corner-radius.tsx"
import { ScrubSlider, ScrubSliderLabel, ScrubSliderValue } from "@/components/ui/scrub-slider";

export function CornerRadius() {
  return (
    <ScrubSlider size="lg" defaultValue={24} max={64}>
      <ScrubSliderLabel>Radius</ScrubSliderLabel>
      <ScrubSliderValue />
    </ScrubSlider>
  );
}
```

## 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/scrub-slider
```

It adds 28 registry items: 25 files, 5056 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## 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)
- [Number Field](https://gelatinui.com/components/number-field.md)
- [Ruler Slider](https://gelatinui.com/components/ruler-slider.md)
- [Elastic Slider](https://gelatinui.com/components/elastic-slider.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. |
| Enter | Opens the text edit of the value. In the edit, Enter saves. |
| Escape | In the text edit: cancels the edit. |

## Accessibility

The thumb is a native range input: the keys step the value, and a form can read it with `name`.

The `ScrubSliderLabel` names the thumb; the text edit has the same name.

The ticks and the visible bar are decoration (`aria-hidden`).

On touch, a swipe across the row scrolls the page and keeps the value. A swipe along it scrubs.

## Motion

| Part | Motion |
| --- | --- |
| Jump | glide · a press, a key, or a typed value glides the fill to the new value |
| Drag | none · a drag follows the pointer at once |
| Stretch | follow · a drag past an end stretches the row up to 8px and springs back on release |
| Thumb | hover · the thumb grows in on hover and focus, and grows more while dragging |
| Text edit | popup · the edit field scales in from 96% while the value fades out |
