suiss/ui · Component
Resizable
Panels separated by draggable handles that let users resize sections of a layout.
Resizable is an open-source component from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.
Resizable wraps react-resizable-panels. ResizablePanelGroup lays out its children in a row or column, alternating ResizablePanel and ResizableHandle. Drag a handle, or focus it and use the keyboard, to change the size of the panels on either side. Groups can be nested to build multi-pane layouts such as an editor with a sidebar and a terminal.
The cards variant renders each panel as a rounded card with a pill-shaped grip between them. Use Resizable for user-adjustable layouts; use Sidebar for a standard collapsible app navigation.
Installation
CLI
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
Manual
- Install the dependencies and add the
cnhelper:
- Copy the source into
components/ui/resizable.tsx:
- Update the import paths to match your project.
Usage
Set orientation on the group to horizontal (default) or vertical. Size panels with defaultSize, minSize and maxSize, for example "30%". Make a panel collapsible with a collapsedSize to let it collapse when dragged past its minimum.
Use onLayoutChange on the group to read the current sizes, keyed by each panel's id.
Examples
With handle
A sidebar and content split with a visible grip and a minimum sidebar size.
Vertical
Panels stacked vertically and resized with the up and down arrow keys.
Nested
A vertical group nested inside a horizontal group to create three panes.
Cards
The cards variant with two collapsible panels that report their share of the space.
Cards vertical
The cards variant in a vertical orientation.
API Reference
ResizablePanelGroup
The container that arranges panels and handles and tracks the layout.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "cards" | "default" | Sets the visual style: default for flat panels with thin dividers, or cards for rounded panels with pill grips. |
Also accepts the props of ResizablePrimitive.GroupProps.
ResizablePanel
One resizable section of the layout.
Also accepts the props of ResizablePrimitive.PanelProps.
ResizableHandle
The draggable divider between two panels.
| Prop | Type | Default | Description |
|---|---|---|---|
withHandle | boolean | - | Shows a visible grip on the divider. |
Also accepts the props of ResizablePrimitive.SeparatorProps.
Accessibility
- Each handle has the
separatorrole witharia-valuenowandaria-orientation, and is focusable with Tab. - Arrow keys resize the adjacent panels; Home and End move the handle to its minimum and maximum.
- A panel that collapses to zero width or height becomes
inert, so its content leaves the tab order.
Notes
- Styling hooks:
data-slotvaluesresizable-panel-group,resizable-panelandresizable-handle. The group exposesdata-variant, and collapsed panels exposedata-empty. - A handle next to a collapsed panel gets
data-collapsedset tostartorend, and its grip appears on hover. - Large layout jumps, such as collapsing or expanding a panel, animate unless the user prefers reduced motion.
- Uses the
border,mutedandmuted-foregroundcolors.