website-glass
Components

Glass Slider

Range slider — the handle lifts into a glass lens while dragging, then snaps back to a solid white platter on release.

42

Install

npx shadcn@latest add https://websiteglass.com/r/glass-slider.json

Usage

import { GlassSlider } from '@/components/ui/glass-slider';

// Uncontrolled
<GlassSlider defaultValue={38} ariaLabel="Volume" />

// Controlled
<GlassSlider
  value={volume}
  onValueChange={setVolume}
  min={0}
  max={100}
  step={1}
/>

Props

PropTypeDefaultDescription
valuenumberControlled value.
defaultValuenumber50Initial value when uncontrolled.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step increment.
onValueChange(v: number) => voidFires on every change.
ariaLabelstring"Slider"Accessible label.

Interaction

On pointerdown the thumb widens, grows taller, and the solid platter fades out, revealing the glass lens. The fill value remains readable through the glass. On release, the thumb springs back and snaps to the nearest step value. Rubber-band overdrag past both ends.