# Resizable

A two-pane layout with a draggable divider between them.

- Category: Navigation & Layout
- Page: https://wunderui.com/components/resizable
- Tier: Core and Pro

## Install

Resizable ships with WunderUI Core and Pro in the @wunderui/react package.

## Import

```tsx
import { Resizable } from "@wunderui/react"
```

## Minimal usage

Then use it:

```tsx
import { Resizable } from "@/components/ui/resizable"

export function Workspace() {
  return (
    <div className="h-60 overflow-hidden rounded-xl border border-border">
      <Resizable defaultSize={160} min={120} max={280} handleLabel="Resize file list">
        <div className="h-full bg-bg-page p-4 text-sm">Files</div>
        <div className="h-full bg-card p-4 text-sm">Pricing</div>
      </Resizable>
    </div>
  )
}
```

Expected result: You should see two panels, Files at 160 px and Pricing taking the rest, with a thin line and a round grip between them. Drag the grip, or focus it and press Arrow keys, to resize Files.

## When to use

### Use Resizable for

- A side panel whose width the reader decides: a file list next to an editor, a message list next to a message
- A bottom panel such as output or a console that opens, grows and collapses
- A layout of two or three panes inside a window of known height

### Use something else

- [Collapsible](https://wunderui.com/components/collapsible) for one section that opens and closes at a fixed size
- [App Layout](https://wunderui.com/components/app-layout) for the frame of a page with a navigation, a top bar and a content area
- [Tabs](https://wunderui.com/components/tabs) for views of one object that the reader switches between, not shows side by side

## Keyboard

The handle is a focusable separator between the two panels in the tab order. Focus it with Tab and move it with Arrow keys of its axis: left and right when horizontal, up and down when vertical.

| Key | Action |
|---|---|
| `ArrowRight` or `ArrowLeft` | Horizontal layout: moves the handle by 16 px. With `side="start"` Arrow Right grows the sized panel and Arrow Left shrinks it; with `side="end"` the two swap. |
| `ArrowDown` or `ArrowUp` | Vertical layout: moves the handle by 16 px. With `side="start"` Arrow Down grows the sized panel and Arrow Up shrinks it; with `side="end"` the two swap. |
| `Shift+ArrowRight` or `Shift+ArrowLeft` or `Shift+ArrowDown` or `Shift+ArrowUp` | The same, in steps of 64 px. |
| `Home` | Sets the sized panel to its `min`. |
| `End` | Sets the sized panel to its `max`. |
| `Tab` or `Shift+Tab` | Moves focus on to the next or previous control. The handle does not trap focus. |

The size stays between the minimum and maximum and leaves 48 px for the other panel. The keys change the size only: they do not collapse or expand a panel.

## Behavior

What the layout does with its size, the pointer and focus.

- **Panels and size:** Pass exactly two children: the first is the start panel (left or top), the second the end panel. One carries the size in pixels, the other takes the rest, and both scroll on their own.
- **Pointer and touch:** The handle follows a mouse, pen or finger and ignores any button but the primary one. While dragging, the page keeps a resize cursor and does not select text.
- **Limits:** The size is kept between the minimum and maximum, and also leaves 48 px for the other panel. In a window 298 px wide the sized panel stops at 250 px, whatever the maximum says.
- **Collapsing:** A collapsed panel is drawn at its collapsed size (0 by default); at 0 it is inert and hidden from assistive technology. The handle keeps its place, and you open the panel again with your own button.
- **Controlled size:** A controlled size overrides the internal state, and the change handler gets the clamped size on every pointer move and key press. Nothing is remembered across a reload, so store it yourself.
- **Accessibility:** The handle is a focusable separator that reports its orientation, size in pixels and label. A collapsed panel reports its collapsed size, so the value never lies below the minimum.
- **Touch size:** The hit area is the line plus 4 px on each side, and the grip is 12 by 24 px. That is smaller than a 44 px touch target, so give touch layouts a second way to change the size.
- **Hover, drag and focus:** The line and grip turn indigo on hover and while dragging, and the grip scales to 110 % when dragged. On focus the line gets a 2 px ring and the grip grows with its own ring.
- **Reduced motion:** With reduced motion the scale of the grip is not animated. The colour changes stay, because they are not motion.

## Anatomy

- `Resizable`: The root: a flex container that fills its parent and holds exactly two panels and the handle. The direction sets the axis and the side names the panel that carries the size in pixels.
- `Sized panel`: The panel with the size in pixels, kept between the minimum and maximum. It scrolls on its own, and when collapsed to 0 it is inert and hidden from assistive technology.
- `Handle`: The divider: a one-pixel line with a 9 px hit area and a focusable separator. Arrow keys move it by 16 px (64 with Shift) and Home and End jump to the limits; it turns indigo on hover, drag and focus.
- `Grip`: The round knob in the middle of the handle, with three dots. It is decoration: it grows with a ring on focus and by 10 % while dragging.
- `Fluid panel`: The other panel. It takes the room that is left, follows the window when it is resized and scrolls on its own.

## Best practices

### Do

- Name the split with the handle label, such as Resize file list. The default Resize panels does not say which panel the handle moves.
- Give the parent a height, such as a window or full height of a layout. The root fills its parent, so without a bounded size nothing lays out.
- Set the minimum so that the sized panel still shows everything at that size. Nothing in the component reflows or clips content for you.
- Persist the size from the size change handler if it should survive a reload. The component keeps its size in memory and starts from the default again.
- Collapse with the collapsed option and a button, not by dragging to zero, and offer buttons for people who cannot drag.

### Don't

- Don't expect the minimum and maximum to beat the window. The size always leaves 48 px for the other panel, so a large maximum is capped by a small window.
- Don't pass more than two children. For three panes put a Resizable inside a panel of another one.
- Don't leave the only way to a feature in a collapsed panel. A panel collapsed to 0 is hidden from the keyboard and from screen readers.

## API reference

### Resizable

| Prop | Type | Default | Description |
|---|---|---|---|
| children* | [React.ReactNode, React.ReactNode] |  | Exactly two nodes. The first is the start panel (left or top), the second the end panel (right or bottom). |
| className | string |  | Classes for the root, a flex container that fills its parent. |
| collapsed | boolean | false | When true, the sized panel renders at `collapsedSize` px. |
| collapsedSize | number | 0 | Size in px of the sized panel while collapsed (default 0). |
| defaultSize | number | 280 | The starting size in pixels of the sized panel. It is kept between `min` and `max`. |
| direction | "horizontal" \| "vertical" | "horizontal" | `horizontal` puts the panels side by side with a vertical handle; `vertical` stacks them with a horizontal one. |
| handleLabel | string | "Resize panels" | Accessible name of the handle, e.g. "Resize sidebar". |
| max | number | 560 | The largest size in pixels of the sized panel. The panel also leaves 48 px to the other one, so a small window caps it. |
| min | number | 120 | The smallest size in pixels of the sized panel. |
| onSizeChange | (size: number) => void |  | Called with the new size in pixels, already clamped, on every pointer move and key press. |
| side | "end" \| "start" \| "left" \| "right" \| "bottom" \| "top" | "start" | Which panel carries the size: `start` (left or top) or `end` (right or bottom). `left`, `top`, `right` and `bottom` are accepted as aliases. |
| size | number |  | Controlled size in px of the sized panel. When provided, overrides internal state. |

## Examples

### Direction: side by side, stacked, or nested

### Sized panel: the one that keeps its pixels

### Range: the smallest and the largest the panel can be

### State: expanded, collapsed or controlled

## In context

### Inbox: a list next to the message

The list is the sized panel. Drag the handle to give the message more room, or focus it and press the arrow keys; the list keeps its own scrolling.

### Editor with an output panel

A vertical split with the output at the bottom as the sized panel. The button collapses it to 0, so the editor takes the whole window.

### A sidebar width that is remembered

The size is controlled and saved in the change handler. The component keeps its size in memory only, so persisting it takes a few lines of your own.

## For AI agents

`get_component("resizable")`

Hand your agent this page as Markdown or the WunderUI MCP server, not a screenshot.
