apps/v4/content/docs/components/base/resizable.mdx
<ComponentPreview styleName="base-nova" name="resizable-demo" previewClassName="h-80" />
The Resizable component is built on top of react-resizable-panels by bvaughn.
npx shadcn@latest add resizable
<Step>Install the following dependencies:</Step>
npm install react-resizable-panels
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="resizable" title="components/ui/resizable.tsx" styleName="base-nova" />
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import {
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
} from "@/components/ui/resizable"
<ResizablePanelGroup orientation="horizontal">
<ResizablePanel>One</ResizablePanel>
<ResizableHandle />
<ResizablePanel>Two</ResizablePanel>
</ResizablePanelGroup>
Use orientation="vertical" for vertical resizing.
Use the withHandle prop on ResizableHandle to show a visible handle.
To enable RTL support in shadcn/ui, see the RTL configuration guide.
<ComponentPreview styleName="base-nova" name="resizable-rtl" direction="rtl" />See the react-resizable-panels documentation.
react-resizable-panels v4Updated to react-resizable-panels v4. See the v4.0.0 release notes for full details.
If you're using react-resizable-panels primitives directly, note the following changes:
| v3 | v4 |
|---|---|
PanelGroup | Group |
PanelResizeHandle | Separator |
direction prop | orientation prop |
defaultSize={50} | defaultSize="50%" |
onLayout | onLayoutChange |
ImperativePanelHandle | PanelImperativeHandle |
ref prop on Panel | panelRef prop |
data-panel-group-direction | aria-orientation |