Skip to content

Resizable Panels

Split panels with a draggable divider you can also operate from the keyboard. Min and max sizes, panels that collapse, and sizes that come back on the next visit.

On this page
Used for
  • Chat and trace split
  • Editor and preview
  • Collapsible sidebar
  • Log panel

Examples

Installation

npx knowns-ui@latest add resizable
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

direction
"horizontal" | "vertical"
Default"horizontal"
Side by side, or stacked. Nest a group in a panel to split the other way.
storageKey
string
Saves the sizes in localStorage and restores them right after mount, so a server render shows the defaults.
onLayout
(sizes: number[]) => void
Sizes in %, after every change.
panel: defaultSize / minSize / maxSize
number (%)
Defaultequal / 10 / 100
Panels without a defaultSize share what is left.
panel: collapsible
boolean
Defaultfalse
Drag it below half its minSize to snap it shut, or press Enter on a neighbouring handle to collapse and reopen it.
handle: withGrip / label
boolean / string
Defaultfalse / "Resize panels"
A grip in the middle of the line, and the accessible name of the divider.
keyboard
role=separator
Arrows move 1% (Shift: 10%), Home and End go to the panel's limits, Enter collapses, double click resets. aria-valuenow is the size of the panel before the handle.
layout
children
Give the group a height. Put panels and handles directly in the group (not inside a wrapper element), alternating.

What it handles

  1. 01Splits a ResizablePanelGroup into panels sized in percent, side by side or stacked with `direction`, each with `defaultSize`, `minSize` and `maxSize`.
  2. 02Resizes by dragging a handle, or by focusing it and pressing the arrow keys for 1 percent and Shift with them for 10.
  3. 03Jumps to a panel's limits with Home and End, and resets the pair to its starting sizes on a double click.
  4. 04Collapses a `collapsible` panel to nothing when it is dragged past half its minimum, or with Enter on its handle, and reopens it the same way.
  5. 05Exposes each handle as a separator with `aria-valuenow`, `aria-valuemin` and `aria-valuemax` for the panel before it, named by `label`.
  6. 06Remembers the sizes in localStorage under `storageKey`, applied after mount, and reports every change through `onLayout`.

States

First render
Nothing. The panels paint at their sizes
none
Dragging a handle
The panels follow the pointer with no easing
none
Keyboard, Enter or double click
The panels glide to the new sizes
180ms, ease out
Handle hover or focus
The handle line changes colour
120ms, ease out
Reduced motion
The sizes change at once
0ms

Works with

When to use

When to use

  • A workspace where people size the panes themselves: files beside an editor, an output panel under it.
  • Layouts that should remember the sizes between visits.

When not to use

  • An app sidebar that folds to a rail: use Sidebar.
  • A fixed two-column layout with no resizing.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Resizable Panels to my app and wire it to my own data.
  • I need a workspace where people size the panes themselves: files beside an editor, an output panel under it. Set that up with the Knowns UI Resizable Panels.
  • Which Resizable Panels props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "resizable" }) and search_docs({ query: "resizable panels" }).

Need help?

Stuck on Resizable Panels, or found something off? We read every message.