Resizable Panel
Resizable Panel: Accessible multi-direction split container with smooth pointer dragging, keyboard ratio controls, and boundary snapping. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.
Install Resizable Panel
npx motion-ui-skill add resizable-panelComponents install as source into your project. The interactive page also includes preview, code, documentation and install tabs.
Dependencies
clsxlucide-reactmotionreacttailwind-merge
Source files
Resizable Panel
Accessible multi-direction split container with smooth pointer dragging, keyboard ratio controls, and boundary snapping. Inspired by shadcn/ui and React Resizable Panels.
Install
npx motion-ui-skill add resizable-panel
Dependencies
clsxlucide-reactmotionreacttailwind-merge
Usage
"use client";
import { ResizablePanelGroup } from "@/components/motion/resizable-panel";
export function ResizablePanelExample() {
return (
<div className="h-96 w-full p-4">
<ResizablePanelGroup
direction="horizontal"
defaultSize={40}
minSize={25}
maxSize={75}
panelA={
<div className="p-4 bg-muted/20 h-full">
<h3 className="text-sm font-semibold">Left Sidebar</h3>
<p className="text-xs text-muted-foreground mt-2">File tree and navigation</p>
</div>
}
panelB={
<div className="p-4 bg-card h-full">
<h3 className="text-sm font-semibold">Editor Surface</h3>
<p className="text-xs text-muted-foreground mt-2">Main workspace</p>
</div>
}
/>
</div>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
direction |
"horizontal" | "vertical" |
"horizontal" |
Split orientation. |
defaultSize |
number |
50 |
Default percentage width/height for panel A. |
minSize |
number |
20 |
Minimum percentage for panel A. |
maxSize |
number |
80 |
Maximum percentage for panel A. |
panelA |
React.ReactNode |
Required | First panel content. |
panelB |
React.ReactNode |
Required | Second panel content. |
onResize |
(size: number) => void |
undefined |
Callback invoked when split ratio changes. |
className |
string |
undefined |
Outer container classes. |