Loading component…
Loading component…
Panes side by side or stacked with a line between them you can drag
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Resizable from ./resizable.
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable";
export function Workspace() {
return (
<div style={{ height: 480 }}>
<ResizablePanelGroup direction="horizontal" onLayout={(sizes) => localStorage.setItem("workspace", JSON.stringify(sizes))}>
<ResizablePanel defaultSize={30} minSize={20} maxSize={50} collapsible>
<RunList />
</ResizablePanel>
<ResizableHandle withHandle aria-label="Resize the runs list" />
<ResizablePanel defaultSize={70} minSize={40}>
<ResizablePanelGroup direction="vertical">
<ResizablePanel defaultSize={65}>
<RunOutput />
</ResizablePanel>
<ResizableHandle aria-label="Resize the log" />
<ResizablePanel defaultSize={35} minSize={15} collapsible>
<RunLog />
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
</ResizablePanelGroup>
</div>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| ResizablePanelGroup · direction | "horizontal" \| "vertical" | "horizontal" | horizontal: panes side by side · vertical: stacked. The group fills its parent – give the parent a height |
| ResizablePanelGroup · onLayout | (sizes: number[]) => void | Every pane's size in %, in order, after the user resizes – store it and pass it back as defaultSize | |
| ResizablePanelGroup · keyboardStep | number | 5 | How far an arrow key moves a handle, in %; Shift doubles it |
| ResizablePanel · defaultSize | number | The size it starts at, in %. Panes without one share what is left; all sizes are scaled to add up to 100 | |
| ResizablePanel · minSize / maxSize | number | 0 / 100 | Its smallest and largest size, in % |
| ResizablePanel · collapsible | boolean | false | Snaps to collapsedSize when dragged past half its minimum; Enter on the handle next to it folds it and brings it back |
| ResizablePanel · collapsedSize | number | 0 | Its size when folded, in %. At 0 it is hidden and inert; a little more keeps an icon rail |
| ResizableHandle · withHandle | boolean | false | A small grip on the line, so it reads as draggable |
| ResizableHandle · aria-label | string | "Resize" | What it resizes, read out by screen readers – e.g. "Resize the runs list" |
| ...div props | ComponentProps<"div"> | className, style, id, ref … go to the group, the pane or the handle |
Sizes are in %, so the layout keeps its proportions at any width; a pane's content never pushes it wider – it scrolls
A 12px grab strip over the line (24px on touch screens) and a bigger grip on touch
Right to left: the panes and the arrow keys follow the reading direction
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"
@import "tailwindcss"; in your main CSS file.