Input
The focus ring closes in around the field on a spring.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/inputThis adds components/keyframery/input.tsx and its primitive to your project, and installs UI SDK. The motion tokens are added to your global CSS the first time you install a component.
Usage
import { Input } from "@/components/keyframery/input"
export default function Usage() {
return <Input placeholder="Email" />
}Examples
Basic
Any native input type. Pair it with a label, or use it inside a Field.
With an icon and a clear button
InputGroup lays an icon or text over the input's edges. InputClear empties it and appears only when there's something to clear.
Disabled and invalid
disabled dims it. aria-invalid marks an error, in red.
Motion
| Move | What you see |
|---|---|
| Spring | The focus ring closes in around the field on a spring. |
| Fade | The hairline changes colour. |
| Pop | A clear button pops in when there is text. |
Timing and springiness follow the motion style you set. To change how fast this input moves, pass speed:
<Input speed="fast">
…
</Input>"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--input-surface | Field surface | --background |
--input-ink | Input text | --foreground |
--input-hint | Placeholder | --muted-foreground at 70% |
--input-focus | Focus ring and hairline | --ring |
--input-invalid | Invalid ring and hairline | --destructive |
--input-radius | Field corners | 10px |
--input-height | Field height | 2.25rem |
API reference
Every part takes className and children. Parts from UI SDK also take render, to draw your own element, and a function of their state for className and style. Props not listed here are in the UI SDK input reference.
Input
Renders a <input>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
InputClear: a<button>InputGroup: a<div>
Keyboard
| Key | What it does |
|---|---|
| Escape | Clears the field, when it has a clear button. |
Accessibility
Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. More in Accessibility.
Swap the import
Already using UI SDK's input with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.
// Before
import { … } from "@ui-sdk/react/input"
// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/input"Questions
How does the animated Input for UI SDK move?
Spring: The focus ring closes in around the field on a spring. Fade: The hairline changes colour. Pop: A clear button pops in when there is text.
Do I need Motion or Framer Motion for the animated Input?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
Can I keep my own styling and only take the motion?
Yes. Import from @/components/keyframery/primitives/input instead. It has the same parts and props as @ui-sdk/react/input and adds motion only.
What happens to the Input when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.
More in Forms
All componentsForm
Fields that settle back while the form sends, a submit button whose label rises through sending to a drawn check, and server errors that open in place under the field they belong to.
Input Group
Icons, text, buttons and a count around an input or textarea, in one field: the focus ring closes in on the whole group, the count rolls as you type and a send button pops in with the first character.