Resizable
Panel groups with draggable, keyboard accessible handles. Horizontal, vertical and nested layouts.
Files
- app/layout.tsx
- app/page.tsx
- lib/db.ts
Editor
Installation
pnpm dlx nachui add resizableAnatomy
Sizes are percentages of the group. Panels without
defaultSize share whatever is left. Dragging a handle moves the boundary between the two panels next to it and never lets either one go past its minSize or maxSize. The handle is a separator with aria-valuenow, focusable, and moves with the arrow keys, Home and End. Hold Shift for bigger steps.Composition
Panels and handles must be direct children of the group so it can number them. Nest another
Resizable inside a panel for grids.Variants
Default
Two panels side by side with a visible grip on the handle.
Files
- app/layout.tsx
- app/page.tsx
- lib/db.ts
Editor
Vertical
direction="vertical" stacks the panels and the handle becomes a horizontal bar.Preview
$ pnpm build
Compiled 42 routes in 3.1s
Ready on http://localhost:3000
Nested
A vertical group inside a panel of a horizontal group.
Sidebar
Editor
Terminal
API Reference
Resizable
| Prop | Type | Default | Description |
|---|---|---|---|
direction | "horizontal" | "vertical" | "horizontal" | Axis of the layout |
onLayout | (sizes: number[]) => void | - | Called with every panel size after a resize |
className | string | - | Classes for the group. Give it a height when vertical |
Resizable.Panel
| Prop | Type | Default | Description |
|---|---|---|---|
defaultSize | number | - | Initial size in percent |
minSize | number | 10 | Smallest size in percent |
maxSize | number | 100 | Largest size in percent |
className | string | - | Additional CSS classes. Content is clipped |
Resizable.Handle
| Prop | Type | Default | Description |
|---|---|---|---|
withHandle | boolean | false | Render a small grip in the middle |
disabled | boolean | false | Ignore pointer and keyboard |
step | number | 2 | Percent moved per arrow key press |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.