Components

Slider

Provides user selection from a range of values.

<Slider defaultValue={[50]} />

API Reference

This component inherits props from the Slider primitive and supports common margin props.

PropTypeDefault
size
Responsive<"1" | "2" | "3">
"2"
variant
"classic" | "surface" | "soft"
"surface"
color
enum
No default value
highContrast
boolean
No default value
radius
"none" | "small" | "medium" | "large" | "full"
No default value

Examples

Size

Use the size prop to control the size.

<Flex direction="column" gap="4" maxWidth="300px">
<Slider defaultValue={[25]} size="1" />
<Slider defaultValue={[50]} size="2" />
<Slider defaultValue={[75]} size="3" />
</Flex>

Variant

Use the variant prop to control the visual style.

<Flex direction="column" gap="4" maxWidth="300px">
<Slider defaultValue={[25]} variant="surface" />
<Slider defaultValue={[50]} variant="classic" />
<Slider defaultValue={[75]} variant="soft" />
</Flex>

Color

Use the color prop to assign a specific color.

<Flex direction="column" gap="4" maxWidth="300px">
<Slider defaultValue={[20]} color="indigo" />
<Slider defaultValue={[40]} color="cyan" />
<Slider defaultValue={[60]} color="orange" />
<Slider defaultValue={[80]} color="crimson" />
</Flex>

High-contrast

Use the highContrast prop to increase color contrast in light mode.

<Grid columns="2" gap="4">
<Slider defaultValue={[10]} color="indigo" />
<Slider defaultValue={[10]} color="indigo" highContrast />
<Slider defaultValue={[30]} color="cyan" />
<Slider defaultValue={[30]} color="cyan" highContrast />
<Slider defaultValue={[50]} color="orange" />
<Slider defaultValue={[50]} color="orange" highContrast />
<Slider defaultValue={[70]} color="crimson" />
<Slider defaultValue={[70]} color="crimson" highContrast />
<Slider defaultValue={[90]} color="gray" />
<Slider defaultValue={[90]} color="gray" highContrast />
</Grid>

Radius

Use the radius prop to assign a specific radius value.

<Flex direction="column" gap="4" maxWidth="300px">
<Slider defaultValue={[25]} radius="none" />
<Slider defaultValue={[50]} radius="small" />
<Slider defaultValue={[75]} radius="full" />
</Flex>

Range

Provide multiple values to create a range slider.

<Slider defaultValue={[25, 75]} />
PreviousSkeleton