Resizable panel groups with composable handle types and variants. Built on react-resizable-panels, wired up with HeroUI design tokens.
Wrap any number of Resizable.Panel children in a Resizable group, separated by Resizable.Handles.
Resizable is a subpath-only import (@heroui-pro/react/resizable) for consistency with the other heavy-dependency components. Its react-resizable-panels peer stays part of the standard (required) peer set because AppLayout also uses it, so you don't need to install anything extra.
import {Resizable} from "@heroui-pro/react/resizable";
<Resizable>
<Resizable.Panel>{/* ... */}</Resizable.Panel>
<Resizable.Handle>
<Resizable.Indicator /> {/* Optional: custom grip */}
</Resizable.Handle>
<Resizable.Panel>{/* ... */}</Resizable.Panel>
</Resizable>;Numbers are interpreted as percentages for consistency with HeroUI Pro's layout APIs. Pass strings such as "220px", "18rem", or "30%" when a panel needs a fixed pixel or CSS-unit constraint:
<Resizable orientation="horizontal">
<Resizable.Panel
defaultSize="280px"
minSize="220px"
maxSize="420px"
groupResizeBehavior="preserve-pixel-size"
>
Sidebar
</Resizable.Panel>
<Resizable.Handle />
<Resizable.Panel minSize={30}>Main content</Resizable.Panel>
</Resizable>Use groupResizeBehavior="preserve-pixel-size" when the panel should keep its current pixel size as the parent group or browser window changes size. The group must still include at least one panel that preserves relative size, so the remaining space has somewhere to go.
Set orientation="vertical" to stack panels and resize along the Y axis.
Three handle affordances: use the one that matches the importance of the boundary.
line: minimal 1px separator. Default. Works everywhere.drag: 1px separator + drag grip chip in the middle. Use when users may not realize the boundary is resizable.pill: 1px separator + rounded pill grip. Highest affordance. Use sparingly, usually for critical boundaries.handle: standalone pill grip with no separator line. Use when you want a drag affordance that floats between panels without a continuous divider.Variants map directly to v3 separator tokens so the handle blends into the surface it sits on.
primary → separator (lightest: default, works on the primary background)secondary → separator-secondary (for background-secondary / surface)tertiary → separator-tertiary (for darker tertiary surfaces)Set withIndicator on a line-type handle to render the drag-dots affordance inline, or compose Resizable.Indicator inside Resizable.Handle for full control.
Panels can contain nested Resizable groups. Use different orientations to build editor-style three-pane layouts.
Set collapsible and collapsedSize on a panel to let it collapse when dragged below its minimum size. Use handleRef for imperative collapse/expand.
Pass autoSaveId to persist panel sizes to localStorage. Reloads restore the previous layout automatically, which works out of the box for client-only apps (Vite, Storybook, etc.).
<Resizable autoSaveId="app:panels">
<Resizable.Panel defaultSize={30} minSize={20}>
Sidebar
</Resizable.Panel>
<Resizable.Handle />
<Resizable.Panel defaultSize={70}>Main</Resizable.Panel>
</Resizable>SSR apps. localStorage isn't available on the server, so the first paint uses the default sizes and the client re-renders after hydration. To avoid this flash, pass createCookieStorage() to storage alongside autoSaveId. It returns a cookie-backed LayoutStorage. Reads fall back to localStorage; writes go to both the cookie and localStorage so cross-tab readers stay in sync. Create the storage in a client component that takes the layout the server read, and give each panel an id:
"use client";
import {createCookieStorage} from "@heroui-pro/react";
import {Resizable} from "@heroui-pro/react/resizable";
const storage = createCookieStorage();
export const ResizableLayout = ({layout}: {layout?: Record<string, number>}) => (
<Resizable autoSaveId="app:panels" storage={storage}>
<Resizable.Panel defaultSize={layout?.sidebar ?? 30} id="sidebar" minSize={20}>
Sidebar
</Resizable.Panel>
<Resizable.Handle />
<Resizable.Panel defaultSize={layout?.main ?? 70} id="main">
Main
</Resizable.Panel>
</Resizable>
);Next.js App Router. In a server layout, read the react-resizable-panels:<autoSaveId> cookie (for example react-resizable-panels:app:panels) with cookies() from next/headers. Its value is a JSON object that maps each panel id to a percentage, such as {"sidebar":30,"main":70}. Parse it, fall back to undefined when it is missing or malformed so the panels use their defaults, and pass the result to ResizableLayout as layout.
HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.
The Resizable component uses these CSS classes:
.resizable: Root panel group; sets the --resizable-* variables.resizable__panel: Panel.resizable__handle: Separator between panels, with a hit area wider than the line.resizable__handle-indicator: Grip centered on the handle.resizable__handle-indicator-icon: Grip icon inside the drag indicator.resizable__handle--primary: separator color (default).resizable__handle--secondary: separator-secondary color.resizable__handle--tertiary: separator-tertiary color.resizable--horizontal / .resizable--vertical: Panels side by side or stacked.resizable__handle--horizontal / .resizable__handle--vertical: Handle thickness and resize cursor.resizable__handle--line: Line handle (default).resizable__handle--drag: Line with a drag grip.resizable__handle--pill: Line with a pill grip.resizable__handle--handle: Pill grip without the line.resizable__handle-indicator--drag / .resizable__handle-indicator--pill: Drag grip and pill shapesThe root .resizable element exposes the following variables for easy customization:
| Variable | Default | Description |
|---|---|---|
--resizable-handle-size | 1px | Visible separator thickness. |
--resizable-handle-hit-area | 8px | Invisible grab area around the line. |
--resizable-handle-color | var(--color-separator) | Default handle color. |
--resizable-handle-color-hover | var(--color-separator-secondary) | Hover color. |
--resizable-handle-color-active | var(--color-accent-soft) | Active/dragging color. |
--resizable-indicator-pill-width | 6px | Pill indicator short axis. |
--resizable-indicator-pill-height | 32px | Pill indicator long axis. |
--resizable-indicator-drag-size | 12px | Drag dots size. |
The panel group. Built on react-resizable-panels by bvaughn.
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" | Layout direction. |
autoSaveId | string | - | Unique id used to persist panel sizes to localStorage. |
onLayout | (sizes: number[]) => void | - | Fires on every layout change (including while dragging). |
storage | LayoutStorage | localStorage | Custom storage implementation for SSR-safe persistence. |
id | string | - | Unique identifier (required for nested groups). |
handleRef | Ref<ImperativePanelGroupHandle> | - | Imperative handle (setLayout, getLayout). |
| Prop | Type | Default | Description |
|---|---|---|---|
defaultSize | number | string | - | Initial panel size. Numbers are percentages; strings accept CSS units. |
minSize | number | string | - | Minimum panel size. Numbers are percentages; strings accept CSS units. |
maxSize | number | string | - | Maximum panel size. Numbers are percentages; strings accept CSS units. |
collapsible | boolean | false | Whether the panel can collapse to collapsedSize. |
collapsedSize | number | string | - | Size applied when collapsed. Numbers are percentages; strings accept CSS units. |
groupResizeBehavior | "preserve-relative-size" | "preserve-pixel-size" | "preserve-relative-size" | Whether the panel keeps its relative percentage or pixel size when the group is resized. |
id | string | - | Unique id (required with autoSaveId + collapsible). |
order | number | - | Panel render order (for conditional rendering). |
onCollapse | () => void | - | Fires when the panel collapses. |
onExpand | () => void | - | Fires when the panel expands. |
onResize | (panelSize: PanelSize, id?: string | number, prevPanelSize?: PanelSize) => void | - | Fires on resize. |
The drag separator between two panels.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "line" | "drag" | "pill" | "handle" | "line" | Affordance style. handle is a standalone pill grip without the separator line. |
variant | "primary" | "secondary" | "tertiary" | "primary" | Emphasis level. Maps to separator tokens. |
withIndicator | boolean | - | Sugar: render the default indicator inside the handle. |
disabled | boolean | false | Whether the handle is disabled. |
onDragging | (isDragging: boolean) => void | - | Fires when drag starts/ends. |
The inner affordance (pill or drag dots) inside a handle. Compose it as a child of Resizable.Handle to customize the grip.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "pill" | "drag" | "pill" | Affordance style when no children are provided. |
children | ReactNode | - | Custom content. Overrides the default affordance. |
Resources