Layout & primitives
ResizablePanels
Free11.7 KB gzippedAccessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab, Arrow Right, Arrow Left and 5 more · Full report
Import
import { ResizablePanels, ResizablePanel } from "@vjdesigns/vjdesigns-ui";
Importing only ResizablePanels adds about 11.7 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Basic
Drag the handle, or focus it and use the arrow keys (Home / End for the limits). The first panel is collapsible: press Enter on the handle to collapse or restore it. Sizes are percentages.
Playbook
Court
import { Box, ResizablePanels, Text } from "@vjdesigns/vjdesigns-ui";
export function Basic() {
return (
<Box radius="lg" border overflow="hidden" style={{ width: "100%" }}>
<ResizablePanels style={{ height: "16rem" }}>
<ResizablePanels.Panel label="Playbook" defaultSize={30} minSize={20} collapsible>
<Box p={4}>
<Text weight="semibold">Playbook</Text>
</Box>
</ResizablePanels.Panel>
<ResizablePanels.Handle />
<ResizablePanels.Panel label="Court">
<Box p={4}>
<Text weight="semibold">Court</Text>
</Box>
</ResizablePanels.Panel>
</ResizablePanels>
</Box>
);
}
Vertical
orientation="vertical" stacks the panels; the arrow keys become Up and Down.
Editor
Console
import { Box, ResizablePanels, Text } from "@vjdesigns/vjdesigns-ui";
export function Vertical() {
return (
<Box radius="lg" border overflow="hidden" style={{ width: "100%" }}>
<ResizablePanels orientation="vertical" style={{ height: "18rem" }}>
<ResizablePanels.Panel label="Editor" defaultSize={60}>
<Box p={4}>
<Text weight="semibold">Editor</Text>
</Box>
</ResizablePanels.Panel>
<ResizablePanels.Handle />
<ResizablePanels.Panel label="Console">
<Box p={4}>
<Text weight="semibold">Console</Text>
</Box>
</ResizablePanels.Panel>
</ResizablePanels>
</Box>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Basic
Playbook
Court
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
<Basic />
</LocaleProvider>
API reference
ResizablePanels
New in 1.5.0| Prop | Type | Default |
|---|---|---|
orientation
| "horizontal""vertical" | "horizontal" |
layoutPanel sizes in percent, in order (controlled). | number[] | — |
defaultLayoutStarting sizes in percent when uncontrolled. Defaults to each panel's | number[] | — |
onLayoutChangeCalled with the sizes (in percent) whenever they change. Persist it to remember a layout. | (layout: number[]) => void | — |
keyboardStepHow much one arrow key press moves a handle, in percent. | number | 5 |
children
| ReactNode | — |
Also accepts native <div> attributes, plus className, style and ref.
ResizablePanels.Panel
New in 1.5.0| Prop | Type | Default |
|---|---|---|
defaultSizeStarting size, in percent of the group. Panels without one share what's left equally. | number | — |
minSizeSmallest size, in percent. | number | 10 |
maxSizeLargest size, in percent. | number | 100 |
collapsibleCan be collapsed: dragging well past | boolean | false |
collapsedSizeSize when collapsed, in percent. At 0 the panel's content is hidden and inert. | number | 0 |
labelName of the panel, used for the handle after it ("Resize Navigation"). | string | — |
childrenPanel content. It scrolls inside the panel when it doesn't fit. | ReactNode | — |
Also accepts native <div> attributes, plus className, style and ref.
ResizablePanels.Handle
New in 1.5.0| Prop | Type | Default |
|---|---|---|
aria-labelAccessible name. Defaults to "Resize {label}" from the panel before it, else "Resize panels". | string | — |
Also accepts native <div> attributes, plus className, style and ref.
ResizablePanel
New in 1.5.0One panel. Its size comes from the group's layout; constraints are its own props.
| Prop | Type | Default |
|---|---|---|
defaultSizeStarting size, in percent of the group. Panels without one share what's left equally. | number | — |
minSizeSmallest size, in percent. | number | 10 |
maxSizeLargest size, in percent. | number | 100 |
collapsibleCan be collapsed: dragging well past | boolean | false |
collapsedSizeSize when collapsed, in percent. At 0 the panel's content is hidden and inert. | number | 0 |
labelName of the panel, used for the handle after it ("Resize Navigation"). | string | — |
childrenPanel content. It scrolls inside the panel when it doesn't fit. | ReactNode | — |
Also accepts native <div> attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
ResizablePanels targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
| Key | Action |
|---|---|
| Tab | Moves to each handle. |
| Arrow RightArrow Left | Horizontal: grows or shrinks the panel before the handle by keyboardStep (mirrored right to left). |
| Arrow DownArrow Up | Vertical: grows or shrinks the panel above the handle. |
| HomeEnd | Moves the panel to its minimum or maximum size. |
| Enter | Collapses or restores a collapsible panel. |
Dragging is never required: every size the pointer can set is also reachable with the keyboard.
Roles and states
| Element | Role | States and properties |
|---|---|---|
| Handle | separator | Focusable; aria-valuenow (the panel's size in percent), aria-valuemin, aria-valuemax, aria-orientation, aria-controls → panel, aria-label ("Resize Playbook") |
| Panel | group | aria-label from label; inert and aria-hidden while fully collapsed |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |