Resizable
Panels the person can resize by dragging a handle or with the arrow keys: an editor beside its preview, a sidebar, a mail list over a reading pane. There is no divider line. The panels are tonal surfaces with a few pixels of background between them, and the handle is a small grip that grows and turns primary when you reach for it.
Install
npx shadcn@latest add @nelumbo/resizableHorizontal
Drag the grip, or Tab to it and use the arrow keys (Home and End go to the limits). withHandle keeps the grip visible; without it the gap is quiet until you hover or focus it.
Without a visible grip
Leave out withHandle for a quieter layout. The grip fades in under the pointer and on keyboard focus.
Vertical
Nested
A mail layout: folders on the left, the list over a reading pane on the right. A panel that only holds another group is transparent, so the gaps stay consistent.
Usage
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"// shadcn's API<ResizablePanelGroup direction="horizontal" className="h-48"> <ResizablePanel defaultSize={30}>Sidebar</ResizablePanel> <ResizableHandle withHandle /> <ResizablePanel>Content</ResizablePanel></ResizablePanelGroup>// A panel that only holds another group<ResizablePanel className="overflow-hidden bg-transparent"> <ResizablePanelGroup direction="vertical">…</ResizablePanelGroup></ResizablePanel>Props
| Prop | Type | Default | react-resizable-panels' own props (direction, onLayout, autoSaveId, minSize, collapsible …) work as is |
|---|---|---|---|
ResizablePanelGroup direction | "horizontal" | "vertical" | Required | |
ResizablePanel defaultSize / minSize / maxSize | number (percent) | Sizes are percentages of the group | |
ResizablePanel className | string | rounded-2xl tonal surface | Override for transparent or custom panels |
ResizableHandle withHandle | boolean | false | Show the grip all the time. Otherwise it appears on hover and focus |
ResizableHandle aria-label | string | Names the separator for screen readers | |
Keyboard | Arrow keys resize, Home and End go to the limits, Enter collapses a collapsible panel |