Panel group
Side-by-side or stacked panes the user resizes by dragging the divider between them, such as code, preview and terminal. It can remember the layout. Import it from "@shavin/ui/panels", not the root. For one element that resizes itself, use the resizable prop on Box, Flex or Card.
// Plain markup
import { Panel, PanelGroup, PanelHandle } from "@shavin/ui/panels";Editor split
Three panes that trade space. Files is collapsible: drag it past its minimum, or focus its handle and press Enter. The layout is remembered.
Files
Code
Preview
Component Source
import { PanelGroup, Panel, PanelHandle } from "@shavin/ui/panels";
<PanelGroup orientation="horizontal" persistKey="editor" className="h-80">
<Panel id="files" defaultSize="22%" minSize={140} collapsible>…</Panel>
<PanelHandle />
<Panel id="code" minSize="30%">…</Panel>
<PanelHandle variant="grip" />
<Panel id="preview" defaultSize="35%" minSize={160}>…</Panel>
</PanelGroup>Nested vertical split
Editor
Terminal
Chat
Component Source
<PanelGroup className="h-96">
<Panel id="main">
<PanelGroup orientation="vertical">
<Panel id="editor">…</Panel>
<PanelHandle />
<Panel id="terminal" defaultSize="30%" minSize={80}>…</Panel>
</PanelGroup>
</Panel>
<PanelHandle color="neutral" />
<Panel id="chat" defaultSize="30%" minSize={200}>…</Panel>
</PanelGroup>Import path
PanelGroup, Panel and PanelHandle come from @shavin/ui/panels, not the root, so apps that never split panes do not bundle the panel engine. It is the same package; the subpath is a separate entry file.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "horizontal" | "vertical" | horizontal | Split direction: "horizontal" puts panels side by side, "vertical" stacks them. Default "horizontal". |
| persistKey | string | — | Remember the layout under this key (saved after the user resizes). Panels need stable `id`s. |
| storage | LayoutStorage | localStorage | Where `persistKey` saves the layout. Default localStorage. For SSR without a layout jump, read the layout from a cookie on the server and pass it as `defaultLayout`. |
| variant | "line" | "grip" | "invisible" | "line" | — |
| color | "brand" | "brand-subtle" | "neutral" | "brand-subtle" | — |