Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Layout & primitives

ResizablePanels

Free11.7 KB gzipped

Accessibility: 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

tsx
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

tsx
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

tsx
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

tsx
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
ResizablePanels props
PropTypeDefault
orientation

horizontal: panels side by side. vertical: panels stacked.

"horizontal""vertical""horizontal"
layout

Panel sizes in percent, in order (controlled).

number[]—
defaultLayout

Starting sizes in percent when uncontrolled. Defaults to each panel's defaultSize.

number[]—
onLayoutChange

Called with the sizes (in percent) whenever they change. Persist it to remember a layout.

(layout: number[]) => void—
keyboardStep

How much one arrow key press moves a handle, in percent.

number5
children

ResizablePanels.Panels with ResizablePanels.Handles between them, as direct children.

ReactNode—

Also accepts native <div> attributes, plus className, style and ref.

ResizablePanels.Panel

New in 1.5.0
ResizablePanels.Panel props
PropTypeDefault
defaultSize

Starting size, in percent of the group. Panels without one share what's left equally.

number—
minSize

Smallest size, in percent.

number10
maxSize

Largest size, in percent.

number100
collapsible

Can be collapsed: dragging well past minSize snaps it to collapsedSize, and Enter on the handle after it toggles it.

booleanfalse
collapsedSize

Size when collapsed, in percent. At 0 the panel's content is hidden and inert.

number0
label

Name of the panel, used for the handle after it ("Resize Navigation").

string—
children

Panel 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
ResizablePanels.Handle props
PropTypeDefault
aria-label

Accessible 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.0

One panel. Its size comes from the group's layout; constraints are its own props.

ResizablePanel props
PropTypeDefault
defaultSize

Starting size, in percent of the group. Panels without one share what's left equally.

number—
minSize

Smallest size, in percent.

number10
maxSize

Largest size, in percent.

number100
collapsible

Can be collapsed: dragging well past minSize snaps it to collapsedSize, and Enter on the handle after it toggles it.

booleanfalse
collapsedSize

Size when collapsed, in percent. At 0 the panel's content is hidden and inert.

number0
label

Name of the panel, used for the handle after it ("Resize Navigation").

string—
children

Panel 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)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 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

Keyboard
KeyAction
TabMoves to each handle.
Arrow RightArrow LeftHorizontal: grows or shrinks the panel before the handle by keyboardStep (mirrored right to left).
Arrow DownArrow UpVertical: grows or shrinks the panel above the handle.
HomeEndMoves the panel to its minimum or maximum size.
EnterCollapses or restores a collapsible panel.

Dragging is never required: every size the pointer can set is also reachable with the keyboard.

Roles and states

Roles and states
ElementRoleStates and properties
HandleseparatorFocusable; aria-valuenow (the panel's size in percent), aria-valuemin, aria-valuemax, aria-orientation, aria-controls → panel, aria-label ("Resize Playbook")
Panelgrouparia-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.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery 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)
FocusFocus 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 readersNames, 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)
ColorMeaning 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 reflowAt 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 targetsClick 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)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)