Layout
ResizablePanels
Panels split by draggable window splitters with keyboard resize, min and max sizes and an optional saved layout.
<script>
import { ResizableHandle, ResizablePanel, ResizablePanels } from "@codeatlasdev/ui";
</script>
<ResizablePanels label="Workspace" persist="workspace-layout">
<ResizablePanel id="files" defaultSize={25} minSize={15}>…</ResizablePanel>
<ResizableHandle label="Resize files" />
<ResizablePanel id="editor" defaultSize={75}>…</ResizablePanel>
</ResizablePanels>
The replacement for react-resizable-panels / shadcn Resizable. Sizes are percentages of the group and always add up to 100; the group fills its container, so give the parent a height. Each ResizableHandle moves the boundary between its two neighbours only, and never past either panel’s minSize / maxSize.
Two panels
Drag the line or focus it and press the arrow keys.
Files
Editor
Files 25% · Editor 75%. Focus the handle and use the arrow keys.
Reference #962 · Pick in the gallery
Code
Nested and saved
A vertical group inside a horizontal one; the layout is kept in localStorage.
Folders
Messages
Reader
Reference #963 · Pick in the gallery
Code
Keyboard
A handle is a WAI-ARIA window splitter: role="separator", focusable, with aria-valuenow the size of the panel before it, and aria-valuemin / aria-valuemax the reachable range. Arrows move 1% (Left and Right in a horizontal group, Up and Down in a vertical one, mirrored in RTL), Shift plus an arrow 10%, Home and End go to the limits. Name each handle after what it resizes.
Saving the layout
persist="key" saves { panelId: percent } in localStorage when a drag or key press settles and restores it on mount. A stored layout that does not name exactly the panels on screen is ignored, so adding a panel never breaks a returning user. Panel ids are therefore part of the key: keep them stable. onlayout receives the same sizes without storage, for your own persistence.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
direction | 'horizontal' | 'vertical' | 'horizontal' | Side by side, or stacked. |
label | string | undefined | Accessible name of the group. |
persist | string | undefined | localStorage key for the layout. |
onlayout | (sizes: number[]) => void | undefined | Sizes in percent, in panel order, when a drag or key press settles. |
class | string | '' | Extra class names. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | – | Stable key of the panel, unique in the group. Required. |
defaultSize | number | undefined | Starting size in percent. Unset panels share what is left. |
minSize | number | 10 | Smallest size in percent. |
maxSize | number | 100 | Largest size in percent. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | 'Resize panels' (localized) | Accessible name; say what it resizes. |
class | string | '' | Extra class names. |