Accessible resizable panels with drag handles for adjusting size.
Horizontal resizable panels with a drag handle.
import { ResizablePanel, ResizablePanelGroup, ResizableHandle, } from "@/components/ui/resizable" export function ResizableDemo() { return ( <ResizablePanelGroup direction="horizontal" className="min-h-[200px] max-w-md rounded-lg border" > <ResizablePanel defaultSize={25}> <div className="flex h-full items-center justify-center p-6"> <span className="font-semibold">Sidebar</span> </div> </ResizablePanel> <ResizableHandle withHandle /> <ResizablePanel defaultSize={75}> <div className="flex h-full items-center justify-center p-6"> <span className="font-semibold">Content</span> </div> </ResizablePanel> </ResizablePanelGroup> ) }
Prop | Type | Default | Description |
---|---|---|---|
direction | horizontal | vertical | horizontal | The axis the panels will resize on. |
defaultSize | number | - | The initial size of the panel in percentage. |
minSize | number | 10 | The minimum size of the panel in percentage. |
maxSize | number | 90 | The maximum size of the panel in percentage. |
withHandle | boolean | false | Whether to show a visual drag handle on the resize handle. |