Navigation

Resizable panels.

Adjustable workspaces with keyboard resizing and recoverable layouts.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/resizable-panels.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Adjustable workspace with a readable mobile fallback

Resize the list and inspector by pointer or keyboard. Collapse and restore the inspector; the host stores committed layouts, and narrow screens show both panels in order.

Keyboard

  • Tab to the separator. Left and Right adjust by two percent; Shift adjusts by ten.
  • Home and End move to the allowed limits. Enter collapses or restores the adjacent inspector.
  • Pointer dragging follows the pointer directly. Escape cancels an active drag.
  • Scroll regions enter the tab order only when their content overflows. Native arrow-key and touch scrolling remain available.

States covered

  • pointer and touch resize
  • keyboard constraints
  • collapse and restore
  • controlled layout
  • host persistence
  • mobile stack
  • reduced motion
  • native scroll regions

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-resizable-workspace-panes.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { useEffect, useState } from 'react';
import { Checkbox, ResizablePanels, ScrollArea, UIProvider, normalizePanelLayout, type PanelLayout } from '@bld8/ui';
const constraints = [{ id: 'records', label: 'Records', minSize: 30, maxSize: 100, defaultSize: 65 }, { id: 'inspector', label: 'Inspector', minSize: 15, maxSize: 70, defaultSize: 35, collapsible: true }];
export default function ResizableWorkspaceExample() {
  const [layout, setLayout] = useState<PanelLayout>(() => normalizePanelLayout(constraints)), [status, setStatus] = useState('Drag the divider or use its keyboard controls.'), [disabled, setDisabled] = useState(false);
  useEffect(() => { try { const saved = localStorage.getItem('workspace-example-layout'); if (saved) setLayout(normalizePanelLayout(constraints, JSON.parse(saved))); } catch { /* Ignore stale or unavailable host storage. */ } }, []);
  return <UIProvider><div style={{ minWidth: 0 }}><Checkbox label="Disable resizing" checked={disabled} onCheckedChange={setDisabled}/><ResizablePanels disabled={disabled} label="Workspace panels" layout={layout} onLayoutChange={setLayout}
    onLayoutCommit={next => { try { localStorage.setItem('workspace-example-layout', JSON.stringify(next)); setStatus('Panel layout saved by this example.'); } catch { setStatus('Layout changed. Browser storage is unavailable.'); } }}
    panels={constraints.map(panel => ({ ...panel, children: <div style={{ padding: 20, background: 'var(--bui-surface)', borderRadius: 6 }}><h3>{panel.label}</h3><ScrollArea label={panel.label + ' content'} style={{ height: 280 }}><div style={{ display: 'grid', gap: 14 }}>{Array.from({ length: panel.id === 'records' ? 24 : 10 }, (_, index) => <p key={index}>{panel.id === 'records' ? 'Record ' + (index + 1) + ' — review keyboard focus and field spacing.' : 'Inspector detail ' + (index + 1) + '. The host owns the selected record.'}</p>)}</div></ScrollArea></div> }))}/>
    <p role="status" className="bui-hint">{status}</p><output aria-label="Current panel layout">{JSON.stringify(layout)}</output>
  </div></UIProvider>;
}

Quick reference

React / TypeScript
<ResizablePanels label="Workspace" panels={panels} onLayoutCommit={saveLayout} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Two to six stable-ID panels share bounded percentage constraints. Pointer and keyboard resizing, collapse/restore, cancellation and explicit commit callbacks use one layout model. Horizontal workspaces stack below their measured mobile breakpoint. Persist only committed layouts; the host owns storage.

ResizablePanels

ResizablePanels public properties
PropTypeDefault
labelRequiredstring—
panelsRequiredreadonly ResizablePanel[]—
classNamestring | undefined—
defaultLayoutReadonly<PanelLayout> | undefined—
disabledboolean | undefinedfalse
layoutReadonly<PanelLayout> | undefined—
mobileBreakpointnumber | undefined640
onLayoutChange((layout: PanelLayout, details: PanelLayoutDetails) => void) | undefined—
onLayoutCommit((layout: PanelLayout, details: PanelLayoutDetails) => void) | undefined

Persist only committed layouts. Pointer cancellation restores the starting proposal.

—
orientation"horizontal" | "vertical" | undefined'horizontal'
showControlsboolean | undefinedtrue
styleCSSProperties | undefined—

ResizablePanelsProps

ResizablePanelsProps public properties
PropTypeDefault
labelRequiredstring—
panelsRequiredreadonly ResizablePanel[]—
classNamestring | undefined—
defaultLayoutReadonly<PanelLayout> | undefined—
disabledboolean | undefined—
layoutReadonly<PanelLayout> | undefined—
mobileBreakpointnumber | undefined—
onLayoutChange((layout: PanelLayout, details: PanelLayoutDetails) => void) | undefined—
onLayoutCommit((layout: PanelLayout, details: PanelLayoutDetails) => void) | undefined

Persist only committed layouts. Pointer cancellation restores the starting proposal.

—
orientation"horizontal" | "vertical" | undefined—
showControlsboolean | undefined—
styleCSSProperties | undefined—

ResizablePanel

ResizablePanel public properties
PropTypeDefault
childrenRequiredReactNode—
idRequiredstring—
labelRequiredstring—
collapsibleboolean | undefined—
defaultSizenumber | undefined—
maxSizenumber | undefined—
minSizenumber | undefined—

PanelLayout

Record<string,number>

PanelLayoutDetails

PanelLayoutDetails public properties
PropTypeDefault
reasonRequired"pointer" | "keyboard" | "collapse" | "restore" | "reset" | "cancel"—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.