Skip to content

Resizable

Accessible resizable panel groups and layouts with keyboard support.

One
Two

Install

Bash
npx @madeui/cli add resizable

Installs react-resizable-panels alongside the component.

Usage

TSX
import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from '@/components/ui/resizable';

Composition

TSX
<ResizablePanelGroup>
  <ResizablePanel />
  <ResizableHandle />
  <ResizablePanel />
</ResizablePanelGroup>

The group fills its parent (width and height 100%), so size the wrapper. Sizes are percentages when passed as strings ("30%") and pixels when passed as numbers (200); other CSS units work as strings too ("12rem", "50vh").

Keyboard

The handle is focusable. Arrow keys move it in 5% steps along the group’s axis, Home and End jump to the neighbouring panel’s minimum and maximum, Enter collapses or expands a collapsible panel, and F6 cycles between the handles of a group.

Vertical

Header
Content

Handle

withHandle renders a grip on the line.

Sidebar
Content

Nested

One
Two
Three

Collapsible

A collapsible panel snaps to collapsedSize when dragged below its minSize. Double-clicking a handle restores the default sizes.

Sidebar
Drag the handle left to collapse

Persisted layout

useDefaultLayout saves the layout under an id and restores it on the next visit. Give each panel a stable id.

API reference

Built on react-resizable-panels v4: ResizablePanelGroup wraps Group, ResizablePanel wraps Panel, and ResizableHandle wraps Separator. The tables below cover the props this library adds or changes — every other prop (defaultSize, minSize, maxSize, collapsible, onLayoutChanged, panelRef, …) is forwarded to the underlying part; see the react-resizable-panels docs for the full list. useDefaultLayout is re-exported unchanged.

ResizablePanelGroup

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'
resizeTargetMinimumSize{ coarse: number; fine: number }{ coarse: 24, fine: 10 }Size in CSS pixels of the pointer target around each handle. The handle draws a 1px line; this is what the pointer actually has to hit. coarse is 24 so a touch drag meets the WCAG 2.2 minimum target size.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles. The library sets width, height, display, flex-direction, and overflow inline.

ResizableHandle

PropTypeDefaultDescription
withHandlebooleanfalseRender a centered grip pill on the line.
aria-labelstring'Resize panels'Accessible name for the handle, which is focusable and announced as a splitter. Override it when a group has several handles that need telling apart.
styleStyleXStyles—StyleX styles merged last — always win over the component’s own styles.

Styling

ResizablePanelGroup, ResizablePanel, ResizableHandle accept style (StyleXStyles, merged last so caller overrides always win). ResizablePanel styles land on the panel’s content box, which the library gives overflow: auto.

Was this page helpful?