ResizablePanel
layoutsA side panel with a drag and keyboard resize handle, min and max bounds, a collapse chevron, persisted width and an overlay drawer mode.
Code editor file tree
Drag or arrow-key the separator; widthKey restores the width and the collapsed state on reload, clamped to minWidth and maxWidth.
Right-hand inspector with live width
side="right"; minWidth="10rem" and maxWidth="70%" take CSS lengths; onresize streams the width, onresizeend reports where it settled; resizeStep sets the arrow-key step.
Collapsible build log
bind:collapsed drives the panel from outside as well as from its edge chevron; persistCollapsed={false} keeps only the width.
Overlay run details drawer
mode="overlay" fixes the panel to the viewport edge above a scrim; Escape or the scrim closes it; under fullWidthBelow="40rem" it spans the screen.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
panel required | Snippet | — | Content shown while the panel is expanded. |
children | Snippet | — | Main content beside the panel (optional in overlay mode). |
side | 'left' | 'right' | 'left' | Physical edge occupied by the panel. |
label | string | 'Side panel' | Accessible name for the panel landmark / dialog. |
width | number | 280 | Initial expanded width in pixels. |
minWidth | number | string | 180 | Pixel number or CSS length (`'12rem'`, `'30vw'`). |
maxWidth | number | string | 480 | Pixel number or CSS length (`'40rem'`, `'90vw'`). |
widthKey | string | — | localStorage key used to restore the expanded width. |
collapsed bindable | boolean | false | Bindable collapsed state (inline mode). |
persistCollapsed | boolean | true | Persist collapsed state as `${widthKey}:collapsed`. |
resizeStep | number | 16 | Pixels added or removed by each resize-separator arrow key press. |
onresizestart | () => void | — | A pointer drag of the separator began. Pair with `onresizeend` to suspend expensive work in the panel body while the width is in flux. |
onresize | (width: number) => void | — | Live width, once per animation frame while dragging and on each keyboard step. |
onresizeend | (width: number) => void | — | Settled width: on pointer release, and after each keyboard step. |
handlePlacement | 'top' | 'bottom' | 'bottom' | Anchor the collapse handle at the top or bottom of the panel edge. |
stickyHandle | boolean | true | Keep the collapse handle in view when the panel scrolls past the viewport, repositioning on scroll/resize via requestAnimationFrame. |
mode | 'inline' | 'overlay' | 'inline' | `inline` shares the row with `children`; `overlay` fixes the panel to its viewport edge as a non-modal drawer above the page. |
open bindable | boolean | false | Bindable drawer visibility (overlay mode). |
onclose | () => void | — | Overlay mode: Escape, scrim click or the edge control closed the drawer. |
scrim | boolean | — | Overlay mode: dim the page behind the drawer; clicking it closes (default true). |
fullWidthBelow | string | — | Overlay mode: viewport width (CSS length) under which the drawer spans the full viewport and hides its resize handle and scrim. |
clampToViewport | boolean | true | Overlay mode: cap the width at the viewport and re-clamp on window resize. |
collapseControl | boolean | — | Render the edge chevron. Defaults to on inline, off in overlay mode (Escape and the scrim already close a drawer). |
class | string | '' | |
style | string | '' |