Input
A text input with a blur-drift character reveal, ghost exit on delete, animated clear button, and invalid shake.
Customize
Installation
npx shadcn@latest add @kinetic/inputUsage
import { Input } from "@/components/kinetic/ui/input";
export function NameField() {
return <Input placeholder="Your name" aria-label="Name" />;
}Sizes
Use size with sm, md, or lg. The default is md.
<Input size="sm" placeholder="Small" aria-label="Small" />
<Input size="lg" placeholder="Large" aria-label="Large" />Clearable
Set clearable to show an animated clear button while the field has a value. Use clearLabel to set its accessible name.
<Input clearable clearLabel="Clear search" defaultValue="Kinetic" aria-label="Search" />Value changes
onValueChange receives the new string directly. The input also works as a controlled field with value and onChange.
const [query, setQuery] = React.useState("");
<Input value={query} onValueChange={setQuery} aria-label="Query" />Reveal tuning
blurPx and driftPx control the blur and horizontal travel of each typed character, and speed scales the animation duration. The reveal applies to type values text, search, url, and tel; other types use the native text rendering, and so does blurPx={0}. Composition input, such as Vietnamese IME, is handled safely: the reveal pauses while composing.
<Input blurPx={6} driftPx={10} speed={1.5} aria-label="Tuned" />Invalid state
Set invalid to mark the field with aria-invalid and play a short shake when the field becomes invalid. aria-invalid="true" also triggers it.
<Input invalid aria-label="Email" defaultValue="not-an-email" />Motion preferences
Character reveal, ghost exit, and the shake respect the Kinetic reduced-motion setting and the browser preference; when reduced motion is active the text changes without animation. Durations use the current tempo and the speed prop.
API Reference
Input
Zero-dependency text input with synced character mirror overlay for horizontal blur-drift typing and deleting, IME safety, clear button, and invalid shake.
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue / onValueChange | string / (value: string) => void | - | Controlled or uncontrolled string value and convenient change callback. |
blurPx / driftPx | number | 4 / 6 | Blur radius (px) and horizontal drift distance (px) for inserted and deleted characters. |
clearable / invalid | boolean | false / false | Shows an animated clear button when non-empty, or triggers invalid styling and micro-shake. |
size / speed / disabled | "sm" | "md" | "lg" / number / boolean | "md" / 1 / false | Input height scale, animation speed multiplier (0.25-4), and disabled state. |