Display
Resizable panels
Drag the divider to trade space.
Mail client
Three panes you can trade space between. Drag a divider or focus it and use the arrow keys. The first pane is collapsible: press Enter on its divider to fold it away and again to bring it back. The layout is saved under the group’s id, so a reload keeps it.
When to use
- Workspaces where people balance two or three regions: mail, code editors, file browsers.
- Panes whose useful size depends on the task, such as a terminal beside code.
Not for a fixed layout (use CSS grid) or for sidebars that only open and close (use a sidebar or sheet).
Vertical
direction="vertical" stacks the panels. withHandle adds a grip that makes the divider easy to find and to hit on touch screens.
// billing/summary.tsx
export function roundCents(amount: number) {
return Math.round(amount * 100) / 100;
}
API
ResizablePanelGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| direction | 'horizontal' | 'vertical' | 'horizontal' | Side by side or stacked. |
| id | string | — | Saves sizes in localStorage under this id. Without one nothing is stored. Storage errors are ignored. |
| onLayout | (sizes: number[]) => void | — | Sizes in % (document order) when a drag or key press ends. |
ResizablePanel
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultSize | number | — | Starting size in % of the group. Panels without one share what is left. |
| minSize / maxSize | number | 0 / 100 | Limits in %. |
| collapsible | boolean | false | Dragging below half of minSize snaps it shut; Enter on its handle toggles it. |
| collapsedSize | number | 0 | Size in % when collapsed. |
| onResize | (size: number) => void | — | Called when the panel’s size changes. |
ResizableHandle
| Prop | Type | Default | Description |
|---|---|---|---|
| withHandle | boolean | false | Show a small grip. |
| aria-label | string | 'Resize panels' | Accessible name; make it specific when several handles exist. |
Give the group a size (h-96); it fills its parent. Panels hide overflow, so put a ScrollArea inside panels that scroll. A ResizableHandle must sit directly between two panels.
Keyboard
| Key | Action |
|---|---|
| ← / → | Moves a vertical divider by 5% (↑ / ↓ for a horizontal divider in a vertical group). |
| Home / End | Moves the divider to the start / end limit the panels allow. |
| Enter | Collapses or restores a collapsible neighbour. |
| Tab | Moves to the next divider. |
Accessibility
- Each divider is a WAI-ARIA window splitter: role="separator", focusable, aria-orientation, aria-valuenow / min / max (the size of the panel before it, in %) and aria-controls.
- Dragging uses pointer capture, so it keeps tracking when the pointer leaves the divider, on mouse, touch and pen.
- Touch targets: the invisible hit area grows from 8px to 24px on coarse pointers.
- The focused or dragged divider is drawn in the ring colour.
Motion
- Dragging follows the pointer with no easing.
- Keyboard collapse and restore glide on the smooth spring.
- Reduced motion: collapse and restore are instant.