Glow input
Text input with a floating label that springs on focus and a cursor-mapped pastel border glow. Label and border share the same colour source — they feel like one light system.
- Spring Physics
- requestAnimationFrame
- pastelColour
glow-input
Incorrect password
Focus any field. Move your cursor.
Usage
Drop it in
import { GlowInput } from "@/app/lib/components/glow-input";<GlowInput label="Email address" type="email" value={email} onChange={setEmail} />
<GlowInput label="Password" type="password" error="Incorrect password" value={pw} onChange={setPw} />API
Props
| Prop | Type | Default |
|---|---|---|
labelFloating label text that springs above the input on focus or when a value is present | string | "Label" |
valueControlled input value | string | "" |
onChangeChange handler called on every keystroke | (value: string) => void | — |
typeHTML input type | "text" | "email" | "password" | "search" | "url" | "tel" | "text" |
placeholderPlaceholder shown once the label has floated and the field is focused | string | "" |
errorError message — locks glow to soft coral pastel and renders message below the input | string | — |
disabledDisables the input and suppresses all glow and spring motion | boolean | false |
classNameAdditional class names applied to the outermost wrapper div | 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.