Resizable
Arrange panels with draggable and keyboard-operated size boundaries.
Anatomy#
Usage#
Use Resizable to split space into draggable, keyboard-operated panels for multi-pane layouts. For a single expandable disclosure or a drawer, use Collapsible or Sheet.
The root owns the size of every panel as a layout record: a Record keyed by panel id, with sizes
as percentages of the group (0–100). Resizable.Panel sets each panel’s min, max, and
collapse constraints. Place Resizable.Handle between two panels to add pointer dragging, keyboard
resizing, and collapse toggles. Set orientation="vertical" on the root to stack panels instead of
placing them side by side.
Panel constraints#
Give the root defaultValue for initial sizes and set min or max on each panel. All values are
percentages of the group. Dragging a handle grows one panel and shrinks its neighbor, stopping at
each panel’s min (default 0) and max (default 100). A panel with resizable={false} stays at
its current size, and the handles next to it are disabled. Panels without an entry in the layout
record share the remaining space.
Collapsible panels#
Set collapsible on a panel to let it collapse to collapsedSize (default 0, clamped between 0
and min). Dragging a handle past the midpoint between min and collapsedSize collapses the
panel, and pressing ↵ on a handle toggles its nearest collapsible neighbor: the
preceding panel first, then the following one. A handle’s children can be a render function that
receives collapsed, dragging, active, canCollapse, disabled, and orientation to switch
the icon; pass false to hide the grip. onCollapse and onExpand fire on transitions, not for the
initial layout.
Inside panel content, Resizable.usePanel() exposes collapse(), expand(), resize(size),
size, and collapsed. Use it to build a collapse button. expand() restores the last expanded
size, or min when there is none.
Controlled state and persistence#
Use value with onValueChange when the application coordinates layout presets, resets, or persists
splits to storage. Both carry the full layout record keyed by panel id. With value set, resizing
only calls onValueChange, and the panels follow the value you pass back. onValueChange fires on
every layout change, including each step of a drag. onValueCommit fires once per completed
interaction: a drag that changed the layout, each keyboard step that changed it, a collapse toggle,
or a usePanel() call.
Keyboard interaction#
Handles render focusable role="separator" elements. Their aria-valuenow, aria-valuemin, and
aria-valuemax describe the preceding panel; aria-valuemin is collapsedSize for a collapsible
panel. A disabled handle (the group is disabled, or a neighbor has resizable={false}) leaves the
tab order. Horizontal groups in right-to-left content swap the arrow keys.
| Key | Description |
|---|---|
| ← / ↑ | Shrinks the preceding panel by step (default 10%). |
| → / ↓ | Grows the preceding panel by step (default 10%). |
| ⇧ + Arrow | Moves the handle as far as the panels’ min and max allow. |
| ↖ | Shrinks the preceding panel as far as the panels’ min and max allow. |
| ↘ | Grows the preceding panel as far as the panels’ min and max allow. |
| ↵ | Toggles the nearest collapsible panel (preceding, then following). |
| Alt + drag | Distributes the movement symmetrically across the panels in groups of three or more. |
Examples#
Constrain an inspector beside a token file#
Set min and max so the inspector cannot consume the editor.
Collapse a project sidebar to an icon rail#
Use collapsedSize for the remaining rail width. ↵ on the handle or a
Resizable.usePanel() button toggles it.
Switch between saved split presets#
Own value when the page stores layout records or offers presets.
Nested IDE workspace#
Combine a horizontal root and a vertical root for an explorer, editor, and console. Set intersection
on the handles that meet so their junction drags on both axes at once.
Multi-column email client#
Compose a folder list, thread list, and reading pane. Min-width constraints keep each column readable.
Vertical query workbench#
Use orientation="vertical" for a query editor over a result table. disabled locks dividers
during execution.
API Reference#
Attributes#
data-splitter-rootdata-collapseddata-expandeddata-resizingdata-transitioningdata-activedata-crossdata-draggingdata-splitter-end-targetdata-splitter-start-targetProps#
Resizable#
Renders a <div> element by default.
Panel#
Renders a <div> element by default.
Handle#
Renders a <div> element by default.