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). Set orientation="vertical" on the root to stack panels
instead of placing them side by side.
Resizable.Panel: sets each panel’smin,max, and collapse constraints.Resizable.Handle: sits between two panels to add pointer dragging, keyboard resizing, and collapse toggles.
Constraints#
Give the root defaultValue for initial sizes and set min or max on each panel. All values are
percentages of the group. Panels without an entry in the layout record share the remaining space.
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.
Collapsible#
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#
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 ausePanel()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 (when 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#
Constraints#
Set min and max on panels to bound their resize range.
Collapsible#
Set collapsible and collapsedSize to snap a panel to a compact rail via ↵ on the
handle or Resizable.usePanel().
Controlled#
Own value when the page stores layout records or offers presets.
Nested panels#
Nest horizontal and vertical roots, and set intersection on meeting handles to drag both axes
simultaneously.
Multi-panel#
Compose three or more panels with independent minimum-size constraints.
Vertical and disabled#
Set orientation="vertical" to stack panels vertically, and disabled to lock dividers.
API Reference#
Attributes#
data-splitter-rootdata-collapseddata-expandeddata-resizingdata-transitioningdata-activedata-crossdata-draggingdata-splitter-end-targetdata-splitter-start-targetProps#
Resizable#
Props for the Resizable component. Renders a <div> element by default.
Panel#
Renders a <div> element by default.
Handle#
Renders a <div> element by default.