Skip to content

    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.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/nudge-field

    First 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

    PropTypeDefaultDescription
    intensitynumber9Shake distance in px.
    durationnumber0.45Shake length in seconds.
    errorReactNode—Error message; the field shakes when it appears or changes.
    attemptReactNode—Bump on each failed submit to shake again with the same error.
    classNamestring—Extra classes for the root element.