Resizable
ProTwo panels split by a draggable handle: one has a size in pixels, the other takes the rest. The handle works with a pointer, a finger and the keyboard.
Playground
Files
Overview
Pricing
Roadmap
Changelog
Pricing
Plans start at $19 per seat.
Installation
Resizable comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { Resizable } from "@wunderui/react"Then use it:
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 for
- Collapsible for one section that opens and closes at a fixed size
- App Layout for the frame of a page with a navigation, a top bar and a content area
- Tabs for views of one object that the reader switches between, not shows side by side
Direction
Horizontal puts the panels side by side with a vertical handle, vertical stacks them with a horizontal one. A Resizable inside a panel makes a layout of three.
Files
Overview
Pricing
Roadmap
Changelog
Pricing
Plans start at $19 per seat.
Preview
Pricing page, 1,280 px
Notes
Annual billing: on
Files
Overview
Pricing
Roadmap
Changelog
Pricing
Annual billing: on
Output
Build OK
Sized panel
The side setting says which panel carries the default size, in pixels. The other panel takes the rest and follows the window when it is resized.
Files
Overview
Pricing
Roadmap
Changelog
Pricing
Plans start at $19 per seat.
Pricing
Plans start at $19 per seat.
Details
Owner: Nora Lindgren
Updated: Nov 4
Size: 2.4 KB
Range
Min and max bound the sized panel. It also always leaves 48 px to the other one, so a large max is capped by a small window.
Width
160 px
Pricing
Plans start at $19 per seat.
Width
160 px
Pricing
Plans start at $19 per seat.
States
Collapsed shrinks the sized panel to its collapsed size, and a panel collapsed to 0 is hidden from the keyboard and assistive technology. A size prop lets you control the size.
State
Pricing
Plans start at $19 per seat.
Pricing
Plans start at $19 per seat.
Pricing
Plans start at $19 per seat.
Pricing
Plans start at $19 per seat.
Keyboard interactions
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.
- ArrowRightorArrowLeft
- Horizontal layout: moves the handle by 16 px. With Arrow Right grows the sized panel and Arrow Left shrinks it; with the two swap.
- ArrowDownorArrowUp
- Vertical layout: moves the handle by 16 px. With Arrow Down grows the sized panel and Arrow Up shrinks it; with the two swap.
- Shift+ArrowRightorShift+ArrowLeftorShift+ArrowDownorShift+ArrowUp
- The same, in steps of 64 px.
- Home
- Sets the sized panel to its .
- End
- Sets the sized panel to its .
- TaborShift+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 and motion
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
The parts of a resizable layout, numbered in the figure. The first panel in the DOM is the start panel, and the side setting decides which of the two has the pixel size.
Files
Overview
Pricing
Roadmap
Pricing
Plans start at $19 per seat.
- 1data-slot="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.
- 2data-slot="resizable-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.
- 3data-slot="resizable-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.
- 4
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.
- 5
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.
- Do
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.
- Do
Set the minimum so that the sized panel still shows everything at that size. Nothing in the component reflows or clips content for you.
- Do
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.
- Do
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
Don't pass more than two children. For three panes put a Resizable inside a panel of another one.
- Don’t
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 is built from plain elements, with no primitive behind it. It takes exactly two children and only the props below.
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.
| Prop | Type | Default | Description |
|---|---|---|---|
| direction | "horizontal" | "vertical" | "horizontal" | puts the panels side by side with a vertical handle; stacks them with a horizontal one. |
| side | "end" | "start" | "left" | "right" | "bottom" | "top" | "start" | Which panel carries the size: (left or top) or (right or bottom). , , and are accepted as aliases. |
| defaultSize | number | 280 | The starting size in pixels of the sized panel. It is kept between and . |
| min | number | 120 | The smallest size in pixels of the sized panel. |
| 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. |
| size | number | — | Controlled size in px of the sized panel. When provided, overrides internal state. |
| onSizeChange | (size) => void | — | Called with the new size in pixels, already clamped, on every pointer move and key press. |
| collapsed | boolean | false | When true, the sized panel renders at px. |
| collapsedSize | number | 0 | Size in px of the sized panel while collapsed (default 0). |
| handleLabel | string | "Resize panels" | Accessible name of the handle, e.g. "Resize sidebar". |
| className | string | — | Classes for the root, a flex container that fills its parent. |
| children required | [ReactNode, ReactNode] | — | Exactly two nodes. The first is the start panel (left or top), the second the end panel (right or bottom). |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("resizable")The full library index for assistants is at /llms.txt.
Related components
- Nora Lindgren renamed Q4 roadmap2 min ago
- Daniel Okafor commented on Pricing14 min ago
- Priya Raman uploaded Onboarding.fig1 hour ago
- Tomás Ferreira archived Brand refresh3 hours ago
- Maya Kessler invited 4 people5 hours ago
- Nora Lindgren published the changelogYesterday
- Daniel Okafor closed 12 issuesYesterday
- Priya Raman moved Help center to Done2 days ago
- Tomás Ferreira changed the billing plan2 days ago
- Maya Kessler created Launch checklist3 days ago
Navigation & Layout2 stylesProScroll AreaA scrollable container with custom, always-styled scrollbars.