Layout & Disclosure
@hacline/ui/resizableResizable
Adjust adjacent panel ratios via pointer drag or keyboard controls.
Usage
Drag the handle or use Left/Right arrow keys when focused. Both defaultSize and minSize are defined as percentages.
Files
requirements.md
Editor
Draft the agenda for the next meeting.
"use client";
import {
Resizable,
ResizableHandle,
ResizablePanel,
} from "@/components/ui/hacline/components/resizable";
export const Example = () => (
<Resizable aria-label="Editor workspace layout" className="h-36 max-w-md">
<ResizablePanel className="p-3" defaultSize={35} minSize={22}>
<strong>Files</strong>
<p className="text-hl-fg-muted mt-1 text-xs">requirements.md</p>
</ResizablePanel>
<ResizableHandle aria-label="Resize file panel width" />
<ResizablePanel className="p-3" minSize={35}>
<strong>Editor</strong>
<p className="text-hl-fg-muted mt-1 text-xs">
Draft the agenda for the next meeting.
</p>
</ResizablePanel>
</Resizable>
);Vertical Panels
Switch orientation to vertical so dragging or Up/Down arrow keys resize the top and bottom regions.
Document preview
Render log
Document rendered successfully.
"use client";
import {
Resizable,
ResizableHandle,
ResizablePanel,
} from "@/components/ui/hacline/components/resizable";
export const Example = () => (
<Resizable
aria-label="Preview and logs"
className="h-48 max-w-sm"
orientation="vertical"
>
<ResizablePanel className="p-3" defaultSize={60} minSize={25}>
<strong>Document preview</strong>
</ResizablePanel>
<ResizableHandle aria-label="Resize preview panel height" />
<ResizablePanel className="p-3" minSize={20}>
<strong>Render log</strong>
<p className="text-hl-fg-muted mt-1 text-xs">
Document rendered successfully.
</p>
</ResizablePanel>
</Resizable>
);Parts
| Part | Description |
|---|---|
ResizableHandle | The handle between two panels: a focusable separator to drag or move with keys. |
ResizablePanel | A panel. Its size is written to --resizable-panel-size on every frame of a drag, so it never renders for a resize unless its render function reads size. |
Props
Prop
Type