Resizable
Panels glide to a new size on a spring, and the handle's grip stretches while you drag.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/resizableThis adds components/keyframery/resizable.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 { Resizable, ResizableHandle, ResizablePanel } from "@/components/keyframery/resizable"
export default function Usage() {
return (
<Resizable>
<ResizablePanel defaultSize={30}>Sidebar</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={70}>Content</ResizablePanel>
</Resizable>
)
}Anatomy
How the parts fit together:
Resizable
├── ResizablePanel
├── ResizableHandle
└── ResizablePanelExamples
Two panels
Drag the handle, or focus it and use the arrow keys. minSize and maxSize are percentages.
Stacked, and nested
orientation="vertical" stacks panels. A Resizable inside a panel splits it again.
Collapsible, and remembered
A collapsible panel snaps shut when dragged below its minSize. autoSaveId keeps the layout between visits.
Motion
| Move | What you see |
|---|---|
| Spring | Panels glide to a new size on a spring after a key press; drags stay instant. |
| Stretch | The grip stretches while you drag it. |
| Fade | The handle's line takes the ring colour. |
Timing and springiness follow the motion style you set. To change how fast this resizable moves, pass speed:
<Resizable speed="fast">
…
</Resizable>"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 |
|---|---|---|
--resizable-line | Resting divider | --border |
--resizable-active | Hovered, focused or dragged divider | --ring |
--resizable-key | Grip surface | --background, --accent in dark |
--resizable-ink | Grip dots | --muted-foreground; --foreground while active |
--resizable-radius | Grip corners | 5px |
--resizable-grip-width | Grip short axis | 0.75rem |
--resizable-grip-length | Grip long axis | 1.5rem |
--resizable-thickness | Divider thickness | 1px |
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 resizable reference.
Resizable
Renders a <div>, and takes its props too.
Prop
Type
ResizablePanel
Renders a <div>, and takes its props too.
Prop
Type
ResizableHandle
Renders a <div>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
ResizableGrip: a<span>
Keyboard
| Key | What it does |
|---|---|
| ← → | Moves the focused handle. |
| Shift + ← | Moves ten steps at a time. |
| Home | Shrinks the panel before the handle as far as it goes. |
| End | Grows it as far as it goes. |
| Enter | Collapses or restores a collapsible panel. |
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 resizable with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.
// Before
import { … } from "@ui-sdk/react/resizable"
// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/resizable"Questions
How does the animated Resizable for UI SDK move?
Spring: Panels glide to a new size on a spring after a key press; drags stay instant. Stretch: The grip stretches while you drag it. Fade: The handle's line takes the ring colour.
Do I need Motion or Framer Motion for the animated Resizable?
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/resizable instead. It has the same parts and props as @ui-sdk/react/resizable and adds motion only.
What happens to the Resizable when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.