Controls
Glass Slider
A glass slider for one value or a range, with one named thumb per value.
Preview
Demos ready. Update 0.
The preview runs the React version. On iOS 26 and later, the React Native version uses the system’s own glass. See it on a phone.
Installation
For React 19+ apps with Tailwind CSS 4.
npx shadcn@4.14.1 add @glassyui/glass-sliderAdds 7 files to components/glassyui and installs @radix-ui/react-slider and clsx.
Usage
Usage
import { GlassSlider } from "@/components/glassyui/glass-slider";
export function SliderDemo() {
return <GlassSlider aria-label="Volume" defaultValue={[60]} max={100} step={1} />;
}React Native usage
import { useState } from 'react';
import { GlassSlider } from '@/components/glassyui/glass-slider';
export default function SliderExample() {
const [price, setPrice] = useState([20, 80]);
return <GlassSlider accessibilityLabel="Price" onValueChange={setPrice} step={5} value={price} />;
}
Examples
Range
<GlassSlider
aria-label="Price"
defaultValue={[20, 80]}
thumbLabels={["Minimum price", "Maximum price"]}
/>API reference
GlassSlider
Renders the track, the filled range and one thumb per value.
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue | number[] | [min] | Controlled or uncontrolled values; the array length sets the number of thumbs. |
onValueChange | (value: number[]) => void | None | Called on every change while dragging or stepping. |
onValueCommit | (value: number[]) => void | None | Called when a drag ends or a key changes the value. |
min / max / step | number | 0 / 100 / 1 | Range and increment of the values. |
aria-label | string | None | Moved to the thumbs: a single thumb takes it as is; range thumbs get it with ', minimum', ', maximum' or ', 2 of 3' added. |
thumbLabels | string[] | None | Names each thumb in value order, replacing the names built from aria-label. |
Also accepts Radix Slider.Root props.
- Types
GlassSliderProps- Accessibility
- Each thumb is its own slider; name range sliders with aria-label or thumbLabels, because aria-labelledby is copied to every thumb and gives them all the same name.
The React Native props and exports are in the component’s source.