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.
Used for
- Chat and trace split
- Editor and preview
- Collapsible sidebar
- Log panel
Examples
Installation
npx knowns-ui@latest add resizableFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Resizable panels from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/resizable
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add resizable
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/resizable.tsx
- components/ui/knowns/resizable-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/resizable, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "resizable" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.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 (%)- Default
equal / 10 / 100 - Panels without a defaultSize share what is left.
- panel: collapsible
boolean- Default
false - 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- Default
false / "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.
| Prop | Type | Default | Description |
|---|---|---|---|
| direction | "horizontal" | "vertical" | "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 (%) | equal / 10 / 100 | Panels without a defaultSize share what is left. |
| panel: collapsible | boolean | false | 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 | false / "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
- 01Splits a ResizablePanelGroup into panels sized in percent, side by side or stacked with `direction`, each with `defaultSize`, `minSize` and `maxSize`.
- 02Resizes by dragging a handle, or by focusing it and pressing the arrow keys for 1 percent and Shift with them for 10.
- 03Jumps to a panel's limits with Home and End, and resets the pair to its starting sizes on a double click.
- 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.
- 05Exposes each handle as a separator with `aria-valuenow`, `aria-valuemin` and `aria-valuemax` for the panel before it, named by `label`.
- 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
| State | What moves | Timing |
|---|---|---|
| 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" }).