Provides user selection from a range of values.
<Slider defaultValue={[50]} />
This component inherits props from the Slider primitive and supports common margin props.
Use the size
prop to control the size.
<Flex direction="column" gap="4" style={{ maxWidth: 300 }}>
<Slider defaultValue={[25]} size="1" />
<Slider defaultValue={[50]} size="2" />
<Slider defaultValue={[75]} size="3" />
</Flex>
Use the variant
prop to control the visual style.
<Flex direction="column" gap="4" style={{ maxWidth: 300 }}>
<Slider defaultValue={[25]} variant="surface" />
<Slider defaultValue={[50]} variant="classic" />
<Slider defaultValue={[75]} variant="soft" />
</Flex>
Use the color
prop to assign a specific color, ignoring the global theme.
<Flex direction="column" gap="4" style={{ maxWidth: 300 }}>
<Slider defaultValue={[20]} color="indigo" />
<Slider defaultValue={[40]} color="cyan" />
<Slider defaultValue={[60]} color="orange" />
<Slider defaultValue={[80]} color="crimson" />
</Flex>
Use the highContrast
prop to increase color contrast in light mode.
<Grid columns="2" gap="4">
<Slider defaultValue={[20]} color="indigo" />
<Slider defaultValue={[20]} color="indigo" highContrast />
<Slider defaultValue={[40]} color="cyan" />
<Slider defaultValue={[40]} color="cyan" highContrast />
<Slider defaultValue={[60]} color="orange" />
<Slider defaultValue={[60]} color="orange" highContrast />
<Slider defaultValue={[80]} color="crimson" />
<Slider defaultValue={[80]} color="crimson" highContrast />
</Grid>
Use the radius
prop to assign a specific radius value, ignoring the global theme.
<Flex direction="column" gap="4" style={{ maxWidth: 300 }}>
<Slider defaultValue={[25]} radius="none" />
<Slider defaultValue={[50]} radius="small" />
<Slider defaultValue={[75]} radius="full" />
</Flex>
Provide multiple values to create a range slider.
<Slider defaultValue={[25, 75]} />