- Add the registry
- Add resizable
Usage
Put ResizablePanels directly in ResizablePanelGroup, or in a Fragment there, with a
ResizableHandle between each pair. The group finds its panels among its children, so a panel
inside a component of your own throws an error; a handle can sit in one. The group fills its parent, so give the parent a height, or
give the group one with className. Sizes are percentages of the group: defaultSize sets where a
panel starts, panels without one share what's left, and minSize and maxSize bound it. A panel
clips what overflows it, so put long content in a Scroll Area, and put padding
on the panel's content rather than the panel, so the panel's size is all the space it takes.
A handle resizes the panels on either side of it. Drag it, or focus it and use the arrow keys to
move it 5% at a time, and Home and End to move it as far as it goes. Give each handle an
aria-label that names the panel before it, which is the one its value describes.
Composition
Examples
Vertical
Set orientation="vertical" to stack the panels. Groups nest, so a panel can hold a group of the
other orientation, as the terminal in the example above does.
With handle
withHandle puts a grip on the line, which is easier to find and to grab on a touch screen.
Collapsible
A collapsible panel collapses to collapsedSize, 0 by default, once it's dragged past half its
minSize, or when an arrow key pushes it past minSize. Enter on the handle collapses the panel
before it, or the one after it when only that one is collapsible, or restores it to its last size,
and a panel at 0 is hidden. A handle never moves either neighbor past its minSize or maxSize,
so a panel only collapses when the panel beside it can take the space.
Pass layout and onLayoutChange to set the sizes yourself, such as from a button, with one size
per panel. An uncontrolled group goes back to its defaultSizes when panels are added or removed,
and refits its sizes when a panel's minSize or maxSize changes, calling onLayoutChange either
way.
Disabled
A disabled handle stays where it is: it can't be dragged, the keyboard skips it, and it shows the
not-allowed cursor. Panels keep their sizes, and the other handles still move them.
Props
The tables leave out className, style and render. Parts built on Base UI take them as its styling and composition guides describe.