Resizable
Panels separated by draggable dividers, for editors, inboxes and split views.
Status: beta. Category: Layout.
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '@glyphui/ui'
Exports: ResizablePanelGroup, ResizablePanel, ResizableHandle, resizableStyles.
Notes
- Built on react-resizable-panels. Sizes are percentages; set defaultSize, minSize and maxSize on each panel.
- Handles are focusable separators: use the arrow keys to resize, Home and End to collapse or expand.
- Pass autoSaveId to the group to remember sizes across visits.
ResizableHandle props
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | ||
hitAreaMargins | PointerHitAreaMargins | ||
id | string | null | ||
onBlur | (() => void) | ||
onClick | (() => void) | ||
onDragging | PanelResizeHandleOnDragging | ||
onFocus | (() => void) | ||
onPointerDown | (() => void) | ||
onPointerUp | (() => void) | ||
tagName | keyof HTMLElementTagNameMap | ||
withHandle | boolean | Show a visible grip on the divider. |
Example: Sidebar and content
import { ResizableHandle, ResizablePanel, ResizablePanelGroup, Text } from '@glyphui/ui'
export default function Example() {
return (
<ResizablePanelGroup
direction="horizontal"
className="min-h-56 max-w-xl rounded-lg border border-border"
>
<ResizablePanel defaultSize={30} minSize={20} className="bg-subtle p-4">
<Text size="small" weight="medium">
Inbox
</Text>
<Text size="caption" tone="muted">
24 conversations
</Text>
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={70} minSize={40} className="p-4">
<Text size="small" weight="medium">
Re: Q4 roadmap
</Text>
<Text size="small" tone="muted">
Drag the divider or focus it and use the arrow keys.
</Text>
</ResizablePanel>
</ResizablePanelGroup>
)
}
Example: Nested groups
A vertical group inside a horizontal one, like an editor with a terminal.
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@glyphui/ui'
export default function Example() {
return (
<ResizablePanelGroup
direction="horizontal"
className="min-h-64 max-w-xl rounded-lg border border-border font-mono text-caption"
>
<ResizablePanel defaultSize={25} className="bg-subtle p-3 text-muted-foreground">
explorer
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={75}>
<ResizablePanelGroup direction="vertical">
<ResizablePanel defaultSize={70} className="p-3">
editor.tsx
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={30} className="bg-subtle p-3 text-muted-foreground">
$ pnpm dev
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
</ResizablePanelGroup>
)
}
Live page: https://glyphui.xyz/components/resizable