Keyframery

Input

The focus ring closes in around the field on a spring.

See it as an AI agent does.

Resize preview. Focus the handle and use the left or right arrow keys. Hold Shift for larger steps.— px
Customize1 controls
Animation speed1×

Installation

npx shadcn@latest add @keyframery/input

This 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

MoveWhat you see
SpringThe focus ring closes in around the field on a spring.
FadeThe hairline changes colour.
PopA 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.

VariableWhat it changesDefault
--input-surfaceField surface--background
--input-inkInput text--foreground
--input-hintPlaceholder--muted-foreground at 70%
--input-focusFocus ring and hairline--ring
--input-invalidInvalid ring and hairline--destructive
--input-radiusField corners10px
--input-heightField height2.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

KeyWhat it does
EscapeClears 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.

All components

On this page