UI

Panels

Horizontal split panes resized by dragging dividers or using the keyboard.

import { ResizablePanels } from '@uthereal/ui/resizable-panels'

Resizable panels playground

Files
overview.mdx
tokens.ts
motion.ts
contract.ts
Editor
export function WorkspaceSplit() {
return <ResizablePanels height={280} />
}
Preview
Build passed · 42 ms
Viewport 640 × 280
0 accessibility warnings
Loading interactive preview…

Overview

ResizablePanels divides a horizontal region into two to six panes separated by draggable dividers. Each divider follows the pointer 1:1, resists past pane size limits, and snaps collapsible panes closed into a restore tab.

Use ResizablePanels when users need to adjust the space between side-by-side views, such as a file tree beside an editor and an inspector. For fixed proportions, give each panel a defaultSize and matching min and max sizes.

Usage

import { ResizablePanel, ResizablePanels } from '@uthereal/ui/resizable-panels'

export function WorkspaceSplit() {
  return (
    <ResizablePanels label="Workspace" height={480}>
      <ResizablePanel
        id="sidebar"
        label="Sidebar"
        defaultSize={24}
        minSize={160}
        maxSize={320}
        collapsible
      >
        <Sidebar />
      </ResizablePanel>
      <ResizablePanel id="editor" label="Editor" defaultSize={76} minSize={240}>
        <Editor />
      </ResizablePanel>
    </ResizablePanels>
  )
}

Pass ResizablePanel children to declare panes alongside their content, or pass the panels array with one content child per pane. Omit height to fill the parent container. Handle onLayoutChange to persist settled percentage shares and onCollapseChange to observe collapsible pane toggles.

Examples

Collapsible three-pane workspace

Combine minSize, maxSize, collapsible, and defaultCollapsed to build a resizable workspace with a collapsible sidebar and an initially hidden inspector. Drag a collapsible pane well past its minimum width, flick toward the edge, or press Enter on its divider to snap it closed. Click the restore tab or press Enter to reopen it at its previous width.

Explorer
src/
components/
foundations/
package.json
Editor
export function WorkspaceSplit() {
return <ResizablePanels height={280} />
}
Inspector
Width: 280 px
Min: 120 px
Collapsible: true

Declarative panels and persisted layout

Use the declarative panels prop with layout and onLayoutChange to restore saved pane shares across sessions. Edits to defaultSize do not move a mounted group.

const [layout, setLayout] = useState<number[] | null>(null)

<ResizablePanels
  label="Workspace"
  height={480}
  layout={layout}
  onLayoutChange={setLayout}
  panels={[
    { id: 'sidebar', label: 'Sidebar', defaultSize: 25, minSize: 160, collapsible: true },
    { id: 'editor', label: 'Editor', defaultSize: 75, minSize: 240 },
  ]}
>
  <Sidebar />
  <Editor />
</ResizablePanels>

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
labelstringDefault: "Resizable panels"Names the group for assistive technology.
panelsResizablePanelEntry[]Default: []Declarative panes with id, label, defaultSize (relative shares), minSize (px, content clips and fades below it), optional maxSize, collapsible and defaultCollapsed. Two to six; empty when ResizablePanel children hold the panes.
heightinteger—Fixed group height in px; omitted fills the container height.
resetOnDoubleClickbooleanDefault: trueDouble-clicking a divider resets the layout to the default sizes.
recipestudio | softDefault: "studio"Visual treatment. Both recipes use the same interaction behavior.
themeResizablePanelsTheme—Color mode, accent, and tokens, including grip and restore-tab geometry. See Theming.
motionnone | subtle | expressiveDefault: "subtle"The pane settle spring, the restore tab pop and the divider color transitions. none makes every change immediate; system reduced motion places widths directly and fades the tab.
motionOptionsResizablePanelsMotionOptions—Fine-grained overrides, such as glideDuration for pane settle; merges over the motion preset.
dirltr | rtl—Reading direction; the first pane sits at the inline start. Omit it to inherit the page direction.

Each entry in panels and each ResizablePanel accepts { id, label, defaultSize, minSize?, maxSize?, collapsible?, defaultCollapsed? }. Relative defaultSize values need not sum to 100. minSize defaults to 80 px; maxSize is unbounded when omitted. defaultCollapsed requires collapsible: true.

React integration

PropPurpose
childrenResizablePanel elements, or one content element per entry in panels.
layoutControlled or persisted pane shares in percent, one per pane.
onLayoutChange(sizes)Called with each pane's share in percent after a resize settles.
onCollapseChange(panelId, collapsed)Called when a collapsible pane snaps closed or reopens.
presetApplication defaults overridden by explicit instance arguments.
tokensCSS variables applied after the typed theme.
ref, className, styleForwarded to the root div.
Native attributesStandard div attributes such as id, aria-*, and data-*, forwarded to root.

Keyboard & accessibility

KeyInteraction
TabMove focus between dividers.
ArrowLeft, ArrowRightMove the divider by 16 px. At a limit, collapse a collapsible pane; from a collapsed pane, reopen at minSize.
Shift + ArrowLeft, Shift + ArrowRightMove the divider by 64 px.
Home, EndJump the divider to its minimum or maximum bound.
EnterCollapse or restore the adjacent collapsible pane.
EscapeCancel an active pointer drag and return the divider to its starting position.

label names the role="group" container. Each divider is a focusable role="separator" with aria-orientation="vertical", aria-controls pointing to the preceding pane, and live aria-valuenow, aria-valuemin, and aria-valuemax percentages. When an adjacent pane is collapsed, aria-valuetext announces <label> hidden, press Enter to show, and the hidden pane's content receives inert.

In right-to-left layouts (dir="rtl" or inherited from the page), the first pane sits at the inline start (right), pointer drag deltas and arrow keys follow the visual direction, and restore tabs and chevrons mirror automatically. Under forced-colors: active, dividers, grips, and restore tabs switch to ButtonText, Canvas, and Highlight focus outlines.

Motion and theming

Dividers write MotionValue flex-grow factors directly during pointer drag for zero per-frame React re-renders. Dragging past minSize or maxSize applies a damped elastic band (up to 44 px), and pane content clips and fades as a pane narrows below its minimum width. Releases, collapses, restores, Home/End jumps, and double-click resets settle on the smooth spring (motionOptions.glideDuration overrides its duration in ms); arrow steps use the snappy spring. The restore tab enters from 0.6 scale through a 2 px blur and exits on the fast standard curve.

Setting motion="none" makes every width change, divider state change, and restore tab toggle immediate (0ms). System prefers-reduced-motion: reduce snaps pane widths immediately and replaces the restore tab scale and blur with a 120 ms opacity fade.

theme accepts mode, accent, and tokens from the core and shape groups plus borderStrong, shadowResting, and component geometry tokens (gripWidth, gripHeight, grabInset, restoreWidth, restoreHeight). An application-wide UtherealProvider supplies defaults.

Composition

In an agent composition, ResizablePanels is a container that accepts two to six ResizablePanel children or declarative panels, never both. Each ResizablePanel is a container for its pane's content elements and must be a direct child of ResizablePanels. Settled pane shares persist as host state at /components/instance-<id>/layout. See Building with agents.

{
  "root": "workspace",
  "elements": {
    "workspace": {
      "type": "ResizablePanels",
      "props": { "label": "Workspace", "height": 480 },
      "children": ["sidebar-pane", "editor-pane"]
    },
    "sidebar-pane": {
      "type": "ResizablePanel",
      "props": {
        "id": "sidebar",
        "label": "Sidebar",
        "defaultSize": 25,
        "minSize": 160,
        "collapsible": true
      },
      "children": ["nav"]
    },
    "editor-pane": {
      "type": "ResizablePanel",
      "props": {
        "id": "editor",
        "label": "Editor",
        "defaultSize": 75,
        "minSize": 240
      },
      "children": ["doc"]
    }
  }
}

On this page