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.
See it as an AI agent does.See this component the way an AI agent does.
Installation
Usage
import { Search } from "lucide-react"
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/keyframery/input-group"
export default function Usage() {
return (
<InputGroup>
<InputGroupAddon>
<Search />
</InputGroupAddon>
<InputGroupInput aria-label="Search" placeholder="Search" />
</InputGroup>
)
}Anatomy
How the parts fit together:
InputGroup
├── InputGroupAddon
└── InputGroupInputExamples
Text on both sides
Addons sit before (inline-start) or after (inline-end) the input. Pressing their text focuses it.
Composer
A textarea with a row under it (block-end). The count rolls as you type, and the send button, marked data-show="filled", pops in with the first character.
With a button
InputGroupButton is Keyframery's Button, sized to sit inside the field. Here it copies a link.
Motion
| Move | What you see |
|---|---|
| Spring | The focus ring belongs to the group: it starts out wide and closes onto the field on a spring. |
| Roll | The count rolls its digits up or down as the text grows and shrinks. |
| Pop | Anything marked data-show="filled", like a send button, pops in with the first character and shrinks away when the field is empty. |
| Press | Buttons in the group sink and spring back. |
Timing and springiness follow the motion style you set. To change how fast this input group moves, pass speed:
<InputGroup speed="fast">
…
</InputGroup>"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-group-face | Field surface | bg-background |
--input-group-ink | Field text | text-foreground |
--input-group-muted | Addon text | text-muted-foreground |
--input-group-radius | Field corners | rounded-[10px] |
--input-group-font | Input size | text-[13px] |
--input-group-height | Input height | h-9 |
--input-group-inset-x | Side padding | px-3 |
API reference
Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.
InputGroup
Renders a <div>, and takes its props too.
Prop
Type
InputGroupAddon
Renders a <div>, and takes its props too.
Prop
Type
InputGroupInput
Renders a <input>, and takes its props too.
Prop
Type
InputGroupButton
Renders a <button>, and takes its props too.
Prop
Type
InputGroupCount
Renders a <span>, and takes its props too.
Prop
Type
InputGroupTextarea
Renders a <textarea>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
InputGroupText: a<span>
Keyboard
| Key | What it does |
|---|---|
| Tab | Moves between the field and the buttons in the group; each is its own tab stop. |
| Enter | Presses the focused button. |
| Space | Presses the focused button. |
Accessibility
Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.
Built on UI SDK's core
UI SDK doesn't ship a input group, so this one is defined with its core: one definePrimitive in components/keyframery/core/input-group-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/input-group.
Questions
How does the animated Input Group for UI SDK move?
Spring: The focus ring belongs to the group: it starts out wide and closes onto the field on a spring. Roll: The count rolls its digits up or down as the text grows and shrinks. Pop: Anything marked data-show="filled", like a send button, pops in with the first character and shrinks away when the field is empty. Press: Buttons in the group sink and spring back.
Do I need Motion or Framer Motion for the animated Input Group?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
UI SDK has no input group. How is this one built on UI SDK?
Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/input-group-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.
What happens to the Input Group when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.