Components

Slider

Provides user selection from a range of values.

<Slider defaultValue={[50]} />

API Reference

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

PropTypeDefault
sizeResponsive<"1" | "2" | "3">"2"
variant"classic" | "surface" | "soft""surface"
colorenumNo default value
highContrastbooleanNo 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" style={{ maxWidth: 450 }}>
<Slider size="1" defaultValue={[25]} />
<Slider size="2" defaultValue={[50]} />
<Slider size="3" defaultValue={[75]} />
</Flex>

Variant

Use the variant prop to control the visual style.

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

Color

Use the color prop to assign a specific color, ignoring the global theme.

<Flex gap="4" style={{ height: 75 }}>
<Slider color="indigo" defaultValue={[25]} orientation="vertical" />
<Slider color="cyan" defaultValue={[50]} orientation="vertical" />
<Slider color="orange" defaultValue={[75]} orientation="vertical" />
<Slider color="crimson" defaultValue={[100]} orientation="vertical" />
</Flex>

High-contrast

Use the highContrast prop to add additional contrast.

<Grid columns="2" gap="4" style={{ maxWidth: 450 }}>
<Slider variant="surface" defaultValue={[75]} />
<Slider variant="surface" defaultValue={[75]} highContrast />
<Slider variant="classic" defaultValue={[50]} />
<Slider variant="classic" defaultValue={[50]} highContrast />
<Slider variant="soft" defaultValue={[25]} />
<Slider variant="soft" defaultValue={[25]} highContrast />
</Grid>

Radius

Use the radius prop to assign a specific radius value, ignoring the global theme.

<Flex gap="4" style={{ height: 75 }}>
<Slider defaultValue={[50]} radius="none" orientation="vertical" />
<Slider defaultValue={[50]} radius="large" orientation="vertical" />
<Slider defaultValue={[50]} radius="full" orientation="vertical" />
</Flex>

Range

Provide multiple values to create a range slider.

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