Textarea
The focus ring closes in on a spring and the character count rolls.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/textareaThis adds components/keyframery/textarea.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 { Textarea } from "@/components/keyframery/textarea"
export default function Usage() {
return <Textarea placeholder="Write a message" />
}Examples
Grows as you type
autoResize makes it as tall as its text. Cap it with a max-h class.
Send with a shortcut
submitShortcut="mod+enter" runs onSubmit on ⌘ Enter or Ctrl Enter, for chat and comment boxes.
With a character count
Pair maxLength with a count so people see how much room is left.
Motion
| Move | What you see |
|---|---|
| Spring | The focus ring closes in on a spring. |
| Roll | The character count rolls. |
Timing and springiness follow the motion style you set. To change how fast this textarea moves, pass speed:
<Textarea speed="fast">
…
</Textarea>"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 |
|---|---|---|
--textarea-face | Field surface | --background; --muted at 50% when read-only; --muted when disabled |
--textarea-ink | Field text and placeholder | --foreground; --muted-foreground at 70% for placeholder |
--textarea-ring | Focus ring and focused hairline | --ring |
--textarea-radius | Field corners | 10px |
--textarea-min-height | Minimum field height | 76px |
--textarea-max-height | Maximum field height | 220px |
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 textarea reference.
Textarea
Renders a <textarea>, and takes its props too.
Prop
Type
Keyboard
| Key | What it does |
|---|---|
| Enter | Sends, when submitShortcut is "enter". Shift + Enter adds a line. |
| Mod + Enter | Sends, when submitShortcut is "mod+enter". |
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 textarea with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.
// Before
import { … } from "@ui-sdk/react/textarea"
// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/textarea"Questions
How does the animated Textarea for UI SDK move?
Spring: The focus ring closes in on a spring. Roll: The character count rolls.
Do I need Motion or Framer Motion for the animated Textarea?
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/textarea instead. It has the same parts and props as @ui-sdk/react/textarea and adds motion only.
What happens to the Textarea when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.