Slider

An interactive input slider that allows users to select a value from a specified range.

Helper text

Usage

import { Slider } from "@lemonsqueezy/wedges";
<Slider />

For more advanced usage, you can use the Slider.Root component to compose your own slider. These components include pre-defined styles and accessiblity features.

<Slider.Root>
    <Slider.Track>
        <Slider.Range />
    </Slider.Track>
    <Slider.Thumb />
</Avatar.Root>

API Reference

The Slider component is built on top of the Radix Slider primitive.

Slider

The Wedges component of the Slider. In most cases this is the only Slider component you will need to use.

PropValueDefault
label
ReactNode
/
description
ReactNode
/
tooltip
ReactNode
/
helperText
ReactNode
/
required
boolean
false
disabled
boolean
false
before
ReactNode
/
after
ReactNode
/
defaultValue
number[]
/
value
number[]
/
onValueChange
function
/
onValueCommit
function
/
name
string
/
orientation
enum
"horizontal"
dir
enum
/
inverted
boolean
false
min
number
0
max
number
100
step
number
1
minStepsBetweenThumbs
number
0

Slider.Root

Contains all the parts of a slider. It will render an input for each thumb when used within a form to ensure events propagate correctly.

PropValueDefault
defaultValue
number[]
/
value
number[]
/
onValueChange
function
/
onValueCommit
function
/
name
string
/
orientation
enum
"horizontal"
dir
enum
/
inverted
boolean
false
min
number
0
max
number
100
step
number
1
minStepsBetweenThumbs
number
0
Data attributeValue
[data-disabled]
Present when disabled
[data-orientation]
"vertical" | "horizontal"

Slider.Track

The track that contains the Slider.Range.

PropValueDefault
asChild
boolean
false
Data attributeValue
[data-disabled]
Present when disabled
[data-orientation]
"vertical" | "horizontal"

Slider.Range

The range part. Must live inside Slider.Track.

PropValueDefault
asChild
boolean
false
Data attributeValue
[data-disabled]
Present when disabled
[data-orientation]
"vertical" | "horizontal"

Slider.Thumb

The range part. Must live inside Slider.Track.

PropValueDefault
asChild
boolean
false
Data attributeValue
[data-disabled]
Present when disabled
[data-orientation]
"vertical" | "horizontal"
[data-state]
"active" | "inactive"

Accessibility

Adheres to the Slider WAI-ARIA design pattern.

Examples

Use orientation prop to create vertical sliders.

You can disable the slider by using the disabled prop.

0100
Helper text

Use range values:

$1,000$10,000
Selected range: $2,500 - $5,000

Controlled component:

Medium

Playground:

1
10
How happy are you with the level of service?
$1,000$10,000
10
Edit this page