Glow checkbox
Checkbox with a spring-physics checkmark that overshoots on toggle. Border glows with cursor-mapped pastel colour on proximity. Box fills with pastel when checked, with a subtle outer bloom.
- Spring Physics
- requestAnimationFrame
- pastelColour
Usage
Drop it in
import { GlowCheckbox } from "@/app/lib/components/glow-checkbox";<GlowCheckbox checked={on} onChange={setOn} label="Remember me" />
<GlowCheckbox checked={false} onChange={() => {}} disabled label="Locked" />API
Props
| Prop | Type | Default |
|---|---|---|
checked*Whether the checkbox is checked | boolean | — |
onChange*Called when the user clicks the checkbox | (checked: boolean) => void | — |
labelLabel text rendered beside the checkbox | string | — |
disabledDisables the checkbox and suppresses all glow and spring motion | boolean | false |
classNameAdditional class names applied to the outermost wrapper | 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.