Skip to content

Now in the official shadcn registry directory.

Start free

Resizable

Draggable split panels built on react-resizable-panels - horizontal or vertical groups, an optional grip, and free nesting for editor-style layouts.

layout
A free styled version is available
Sidebar
Drag the handle to resize

Installation

Run the following command

npx shadcn@latest add @ai2/resizable

Dependencies including react-resizable-panels, the @ai2/tokens theme and the component file are installed together.

Usage

TS
import {
  ResizableHandle,
  ResizablePanel,
  ResizablePanelGroup,
} from "@/components/ui/resizable"

<ResizablePanelGroup direction="horizontal">
  <ResizablePanel defaultSize={35}>Sidebar</ResizablePanel>
  <ResizableHandle withHandle />
  <ResizablePanel defaultSize={65}>Content</ResizablePanel>
</ResizablePanelGroup>

Set direction on the group, give each ResizablePanel a defaultSize in percent, and place a ResizableHandle between them. Give the group a height or the panels collapse to zero.

Examples

Horizontal

Sidebar
Content

Vertical

Header
Body

With and without a handle

The seam is draggable either way. Pass withHandle to show a grip; omit it for a bare rule.

Left
Right

Nested groups

Files
Editor
Terminal

Props

Every part also forwards its underlying react-resizable-panels props - for example onLayout on the group and onResize on a panel.

ResizablePanelGroup

PropTypeDefaultDescription
direction"horizontal" | "vertical"-Required. Lays the panels out in a row (horizontal) or a column (vertical). Drives the data-panel-group-direction attribute the handle reads.
autoSaveIdstringundefinedPersists panel sizes under this key so the layout is restored on reload (forwarded to react-resizable-panels).

ResizablePanel

PropTypeDefaultDescription
defaultSizenumberundefinedStarting size of the panel as a percentage of the group (0 to 100). Sizes across a group should add up to 100.
minSizenumberundefinedLower bound in percent the panel cannot be dragged below.
maxSizenumberundefinedUpper bound in percent the panel cannot be dragged above.
collapsiblebooleanfalseAllows the panel to collapse to collapsedSize when dragged past its minSize (forwarded to react-resizable-panels).

ResizableHandle

PropTypeDefaultDescription
withHandlebooleanfalseRenders a visible grip in the center of the divider. Without it the whole seam is still draggable, just unmarked.
disabledbooleanfalseLocks the handle so the adjacent panels cannot be resized.

ai2 Resizable: draggable split panels for React layouts

The ai2 Resizable is a shadcn-compatible set of split-panel primitives for React, built on react-resizable-panels and styled with Tailwind CSS v4. It lets users drag a divider to resize adjacent regions, the way a code editor splits a file tree from the editor from a terminal. Groups run horizontally or vertically and nest freely.

Because it ships through the shadcn registry format, you install it with one CLI command, an MCP agent, or a copy-paste, and the source lands in your own project. You own the file; there is no runtime dependency on ai2 itself. The live example above is the exact component you get.

What is the ai2 Resizable?

It is a three-part composition: ResizablePanelGroup, ResizablePanel and ResizableHandle. The group sets the direction, each panel takes a defaultSize in percent, and a handle sits between panels as the draggable seam. The anatomy matches shadcn/ui exactly, so existing snippets and AI agents keep working without changes.

The handle is a thin border by default; pass withHandle to show a small grip so users can find it. Sizes are percentages that add up to 100 within a group, and panels accept minSize and maxSize to keep a region usable. Because groups nest, a horizontal split can contain a vertical split for full IDE-style layouts.

Why use it

  • Real drag-to-resize: react-resizable-panels handles pointer dragging, percentage math and constraints, so panels resize smoothly and stay within their min and max bounds.
  • Horizontal, vertical and nested: Set direction on the group and nest groups inside panels to build side-by-side, stacked or full editor-style layouts from the same three parts.
  • Optional visible grip: The whole seam is draggable, and withHandle adds a centered grip so the affordance is obvious. The grip auto-rotates for vertical groups.
  • Keyboard accessible: The underlying resize handle is focusable and moves with the arrow keys, and it carries a focus-visible ring so keyboard users can see and drive it.
  • Agent-readable metadata: The registry item describes its parts and intended use in plain words, so an MCP agent can find, inspect and install it without guessing.

Features

  • shadcn registry install: One command adds the component, react-resizable-panels and the @ai2/tokens theme to your project.
  • Percentage sizing: defaultSize, minSize and maxSize are percentages of the group, so layouts stay proportional as the container grows or shrinks.
  • Direction-aware handle: The handle reads data-panel-group-direction to switch between a vertical rule and a horizontal rule, and rotates the grip to match.
  • Persisted layouts: Pass autoSaveId to a group and react-resizable-panels stores the sizes, restoring the user's layout on the next visit.
  • Collapsible panels: Mark a panel collapsible to let it snap shut past its minSize, useful for sidebars that fold away.
  • Data attributes for styling: Every part exposes data-slot, and the group and handle expose data-panel-group-direction, so you can restyle seams from CSS without forking.

Production tips

  • Give the group a height: Panels fill their group, so a horizontal group still needs a height (for example h-48 or h-full). Without one the panels collapse to zero.
  • Make sizes add up to 100: defaultSize values across one group are percentages; keep them summing to 100 so the initial layout matches what you intend.
  • Set a minSize on tight panels: A sidebar dragged to a few pixels is unusable. Give small panels a minSize so they stay legible no matter how far the handle is pulled.
  • Use withHandle for discoverability: The bare seam works but is easy to miss. Add withHandle on the primary dividers so users see there is something to drag.
  • Nest, do not overcrowd: Two or three panels per group reads clearly. For an IDE layout, nest a vertical group inside a panel rather than packing five panels into one row.

Works with the rest of ai2

Resizable panels frame larger layouts across the registry. Fill a panel with a ai2 Scroll Area so long content scrolls inside its region, and drop an ai2 Item list into a sidebar panel for a navigable file tree.

Pair it with a ai2 Card inside each panel for framed regions, or a ai2 Separator for non-draggable divisions within a single panel. Everything shares one token source, so combinations stay visually consistent in both modes.

FAQs

Get new components in your inbox

Component drops, new themes and release notes. No spam, and you can unsubscribe from any email.

© 2026 ai2 design system · MIT licensed · Built with its own components