Browse components
Nudge Field
A text field that answers a bad value with a quick damped shake, a destructive border and an error message that slides in below. Shakes again on every failed submit.
Installation
npx shadcn@latest add @glint-ui/nudge-fieldFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/nudge-field.json
Usage
import { NudgeField } from "@/components/ui/nudge-field";
<NudgeField
label="Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
error={error}
attempt={attempts}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| intensity | number | 9 | Shake distance in px. |
| duration | number | 0.45 | Shake length in seconds. |
| error | ReactNode | — | Error message; the field shakes when it appears or changes. |
| attempt | ReactNode | — | Bump on each failed submit to shake again with the same error. |
| className | string | — | Extra classes for the root element. |