Glow slider
Range slider with spring-physics thumb bounce on grab and release. Fill and border glow with cursor-mapped pastel colour. Drag intensifies the bloom. All motion via rAF springs, no CSS transitions.
- Spring Physics
- requestAnimationFrame
- pastelColour
Volume
Opacity
Brightness
Usage
Drop it in
import { GlowSlider } from "@/app/lib/components/glow-slider";<GlowSlider label="Volume" value={vol} onChange={setVol} />
<GlowSlider label="Opacity" min={0} max={1} step={0.01} value={op} onChange={setOp} />API
Props
| Prop | Type | Default |
|---|---|---|
value*Current value | number | — |
onChange*Called when the user drags or clicks to change value | (value: number) => void | — |
minMinimum value | number | 0 |
maxMaximum value | number | 100 |
stepStep increment | number | 1 |
labelLabel displayed above the slider | string | — |
showValueWhether to show the numeric value on the right | boolean | true |
disabledDisables the slider and suppresses all glow and spring motion | boolean | false |
classNameAdditional class names applied to the outermost wrapper | string | "" |
ariaLabelAccessible name when no visible `label` is given | string | — |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.