Shadcn Range Slider
A slider in five skins (pill, classic, dotted, tile and flight) plus a circular dial. One thumb or two. Headings and readouts are yours to place around it.
About Shadcn Range Slider
What it is. Two exports, RangeSlider (straight) and CircularRangeSlider (a dial). Pass a number for a single thumb or [from, to] for a range. Neither draws a heading or readout: build that beside them.
How it is built. React and Tailwind, no dependencies. Pointer capture drives the drag, so it works with mouse, touch and pen. Colours come from the theme tokens, so every preset and dark mode restyle it.
When to use it. Price and date filters, volume and brightness, seat or quantity pickers.
For AI agents
Hand your agent this brief or the Markdown page, not a screenshot.
When to use
- Picking a number or a range from a bounded scale, with live feedback
- Price and quantity filters with a min and a max
When not to use
- A few exact choices: use Toggle Group
- A big figure picked by scrolling: use Scale Picker
Agent notes
- Named exports:
RangeSliderandCircularRangeSliderfrom@/components/custom/blocks/RangeSliderBlock - The slider draws no label or readout. Render those yourself and read the value from
onValueChange;labelis only the accessible name CircularRangeSlidertakeschildrenfor the middle of the ring- The value shape follows the input:
numbergives a number back,[number, number]gives a pair back - Controlled when
valueis set; hold it in state and update it inonValueChange - Thumbs never cross. Each is
role="slider"; arrows step, PageUp/PageDown move a tenth, Home/End jump to the ends
For AI agents6 variants. Ask the user which one.
Ask before you pick. This page has 6 variants. If the user has not named one and has not asked you to choose for them, ask which they want before you install anything or write code, and show every option with its live link. If they ask you to choose, pick from each variant's best-for and avoid-if lines against their brief, and say why. If the user named a variant, use it and do not ask.
All 6 options as live previews: https://avaraui.com/view/range-slider
When to use it. A slider for picking a number or a range from a bounded scale. Pass a number for one thumb or `[from, to]` for two. It draws no heading or readout: build those beside it.
When to use something else
- Toggle Group: a few exact choices rather than a scale.
Gotchas
- All of them are skins of the one `range-slider` item: install it once and set `variant` (`pill`, `dotted`, `classic`, `tile`, `flight`) on `RangeSlider`, or use `CircularRangeSlider` for the dial.
- `flight` takes a single thumb; `tile` draws `label` and the value inside the tile.
- One thumb or two is just the shape of `value` (number or `[from, to]`), not a separate design.
The 6 variants
Pill pill
The default bar with a pill thumb; one value or a range.
- Best for: price filters and volume or brightness controls
- Avoid if: you want visible steps or a bold, branded control
- Traits: plain bar, one or two thumbs, default skin
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
Dotted steps dotted
A dot per step and a slim thumb that stays inside the range.
- Best for: a few discrete quantities such as seats or guests
- Avoid if: the scale is continuous with many values
- Traits: dot per step, slim thumb, discrete
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
Classic classic
Round thumbs, a tick per step and a value bubble on hover.
- Best for: time or date range pickers that need readable ticks
- Avoid if: you want a minimal bar with no ticks
- Traits: round thumbs, step ticks, hover value bubble
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
Tile tile
A button-like tile that draws its label and value inside and slides as you drag.
- Best for: settings panels with several labelled controls, such as colour channels
- Avoid if: you need a range with two thumbs
- Traits: label inside, value inside, compact tile
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
Flight flight
A glowing bar with a plane at its tip and a readout on the right.
- Best for: travel and booking pages, or a playful progress-like picker
- Avoid if: you need two thumbs or a sober admin look
- Traits: glow from theme colour, plane thumb, single thumb
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
Circular dial circular
A ring dial with a gap between fill and track; children sit in the middle.
- Best for: thermostat, volume or timer style controls with a central readout
- Avoid if: space is a thin strip
- Traits: ring, centre content slot, separate CircularRangeSlider export
- Install:
npx shadcn@latest add @avara-ui/range-slider - Docs section
- Markdown
- /docs-md/nextjs-range-slider.md
- Install
npx shadcn@latest add https://avaraui.com/r/range-slider.json- Registry name
@avara-ui/range-slider, through the shadcn MCP server- Index
- llms.txt lists every page, or add the agent skill once
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
value, defaultValue | number | [number, number] | the midpoint | One thumb or two. Set value to control it. |
onValueChange | (value) => void | - | Fires on every move, in the same shape as value. |
min, max, step | number | 0, 100, 1 | The scale and its snap size. |
format | (value: number) => string | String | Text for the readout and screen readers. |
label | string | - | Accessible name for the thumbs. Not drawn. |
marks | number[] | - | Values labelled under the track. RangeSlider only. |
formatMark | (value: number) => string | format | Text for each mark, such as String for bare numbers. RangeSlider only. |
children | ReactNode | - | Drawn in the middle of the ring. CircularRangeSlider only. |
variant | "pill" | "classic" | "dotted" | "tile" | "flight" | "pill" | The skin. RangeSlider only. classic adds step ticks and a value bubble. tile draws label and the value inside; flight takes one thumb. |
disabled | boolean | false | Fades the slider and ignores input. |
Works with other components
- Put it in a Card or a filter sidebar filter sidebar.
- For a plain shadcn input slider, use
ui/slider.
How do I make a price range slider?
Pass a two-number defaultValue, such as [240, 720], and a format that adds the currency. onValueChange returns [from, to].
How do I control the value?
Set value and update it in onValueChange. With only defaultValue the slider keeps its own state.
Is it keyboard accessible?
Yes. Each thumb is focusable. Arrow keys move one step, PageUp and PageDown move a tenth of the scale, and Home and End jump to the ends. aria-valuetext uses your format.