Skip to content

React Resizable Panels

Resizable panels for React split a layout into regions with draggable, keyboard-resizable handles, size limits and nested groups. Use Resizable panels for workspaces where people choose how much room each area gets: a file tree beside an editor, a list beside a detail pane, a console under a canvas.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/resizable.json

Files 50%

Editor 50%

  • ResizablePanel
  • ResizableHandle
  • ResizablePanelGroup
  • defaultResizableLabels
  • +2 more

Editor, preview and console

Drag a handle, or focus it and use the arrow keys. The middle pane holds a vertical group; every panel respects its minimum size.

Explorer

  • App.tsx
  • Deploy.tsx
  • theme.css
  • package.json
App.tsx
1import { Button, Progress } from "@sheenui/theme";
2
3export function Deploy() {
4 return (
5 <Button variant="glass">Deploy</Button>
6 <Progress value={72} label="Build" />
7 );
8}
Console
  • ✓ compiled in 142 ms
  • ready on http://localhost:5173
  • ⚠ Deploy.tsx: unused import Progress

Preview

Build
x

Files to copy

4 folders · 5 files · 4 packages
From theme/src/
  • components/resizable/
  • hooks/{use-direction.ts, use-latest.ts}
  • lib/{cn.ts, form.ts, math.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/resizable.jsonRegistry item: resizable. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/progress/
  • components/spinner/
  • hooks/{use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/state-light.tsx
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json https://lokendra-builds.github.io/sheenui/r/progress.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Controlled and remembered

Pass layout and onLayoutChange to own the sizes, for example to save them in localStorage and restore them on the next visit. The sizes are percentages that add up to 100.

Sidebar: 30%

Content: 70%

ResizablePanelGroup props

PropTypeDefaultDescription
children (required)ReactNodeNoneResizablePanels with a ResizableHandle between each pair (they may sit inside your own components).
orientation"horizontal" | "vertical""horizontal"Direction the panels sit in: "horizontal" (side by side, default) or "vertical" (stacked).
layoutnumber[]NonePanel sizes as percentages that add up to 100 (controlled). Pair with onLayoutChange.
defaultLayoutnumber[]each panel's defaultSizeStarting sizes when uncontrolled: each panel's defaultSize, else an equal share of what is left.
onLayoutChange((layout: number[]) => void)NoneCalled with the new sizes while a handle is dragged or moved with the keyboard.
keyboardStepnumber5Percent a handle moves per arrow key (Shift moves five times as much).
disabledbooleanfalseLocks every handle so no panel can be resized.
labelsPartial<ResizableLabels>defaultResizableLabelsEvery other string, for translation: labels={{ resize: "…" }}; omitted keys keep the English of defaultResizableLabels. All 3 keys of ResizableLabels are listed in the key table under the props table.
ResizableLabels keys and English defaults (3)
Pass any key in labels; the rest keep the defaults of defaultResizableLabels.
KeyEnglish default
resizeResize panels
growMake the first panel larger
shrinkMake the first panel smaller

ResizablePanel props

PropTypeDefaultDescription
defaultSizenumberNoneStarting size in percent. Panels without one share what is left equally.
minSizenumber10Sets the smallest size in percent.
maxSizenumber90Sets the largest size in percent.

ResizableHandle props

PropTypeDefaultDescription
withGripbooleanfalseDraw a small grip in the middle of the line.

All exports on this page

  • ResizableHandle — The draggable divider between two panels of a ResizablePanelGroup.
  • ResizablePanel — One panel of a ResizablePanelGroup.
  • ResizablePanelGroup — Panels with draggable, keyboard-resizable handles between them: a file tree next to an editor, a list next to a detail pane, a console under a canvas.
  • defaultResizableLabels — The English ResizableLabels used when labels is omitted; a partial labels prop is merged over it.

Keyboard

KeysAction
TabFocuses a handle.
←/→Move the focused handle (↑ / ↓ in a vertical group) by keyboardStep percent.
Shift + arrowMove it five times as far.
Home/EndSend the handle to the limit of its range.
Step buttonsTwo buttons on the handle make the panel before it larger or smaller with a single press (the non-drag alternative); always visible on touch screens, shown on keyboard focus elsewhere.
Double click/double tapPuts the divider back where it started.

Accessibility

  • Each handle is a role="separator" (the ARIA window splitter pattern) with aria-orientation, aria-valuenow (percent of the panel before it), aria-valuemin, aria-valuemax and aria-controls, named by labels.resize.
  • Every drag has a keyboard equivalent; the grab area is 44px on touch screens and works with mouse, touch and pen.
  • Panels never shrink below minSize or grow past maxSize, so content is not lost. In right-to-left pages the arrow keys and the drag follow the reading direction.
  • Resizing follows the pointer directly; there is no animation, so reduced motion changes nothing.

When to use the resizable panels

  • Use Resizable for an IDE-style workspace, an email client or a log viewer, where people drag a handle (or press the arrow keys) to choose how much room each area gets.
  • Put ResizablePanel children in a ResizablePanelGroup with a ResizableHandle between each pair. Set minSize and maxSize so a panel never collapses past usefulness.
  • Own the sizes with layout and onLayoutChange when you want to save them in localStorage or a user setting and restore them later.
  • Skip it for a fixed two-column layout. CSS grid is lighter when nobody needs to resize.
  • Pair it with ScrollArea inside each panel, with a vertical group nested in a horizontal one for editor layouts, and with Drawer for the phone version.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .