Resizable
Panels people resize by dragging the handle between them: side by side editors, inboxes and dashboards.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add resizableAlso works with shadcn:
npx shadcn@latest add @ritla/resizableDependencies it brings
@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { ResizableGroup, ResizableHandle, ResizablePanel } from "@/components/ui/resizable";<ResizableGroup> <ResizablePanel defaultSize={36} minSize={20}>Sidebar</ResizablePanel> <ResizableHandle withGrip /> <ResizablePanel minSize={30}>Content</ResizablePanel></ResizableGroup>Examples
Vertical
orientation="vertical": top and bottom. ArrowDown makes the top panel taller.
Nested
A vertical group inside a panel. The inner group is bare and its handle has no grip, as in Figma.
Remember sizes
storageKey keeps the sizes in this browser so the layout survives a reload; onLayoutChange hands them to you to save per user on your server.
API reference
ResizableGroup
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" | Figma's Layout: side by side or top and bottom. Nest a group in a panel for both. |
storageKey | string | None | Saves the sizes in localStorage under this key. |
onLayoutChange | (sizes: number[]) => void | None | The sizes (%, in order) after each resize. |
bare | boolean | false | No frame, for a group inside a panel. |
ResizablePanel
| Prop | Type | Default | Description |
|---|---|---|---|
defaultSize | number | None | The starting size (%). Panels without one share the rest. |
minSize | number | 10 | The smallest size (%), so content never collapses. |
maxSize | number | 100 | The largest size (%). |
ResizableHandle
| Prop | Type | Default | Description |
|---|---|---|---|
withGrip | boolean | false | Figma's Grip: where resizing is the main task. |
label | string | "Resize" / «تغيير الحجم» | The handle's name for screen readers. |
step | number | 5 | The arrow keys' step (%). |
Usage guidelines
Resizable panels split a workspace with a handle between them. When to use them, their order in Arabic, and the checks before handoff.
1. Resizable panels
Two or three panels with a handle between them. Horizontal splits a workspace; Vertical splits an editor and output; Nested does both.
Do
- Set a minimum width per panel.
- Remember the last size per person.
Don't
- Add a handle between more than three panels.
- Resize both axes with one handle.
2. Arabic and RTL
Panel order mirrors; the handle keeps its grip.
Before handoff
- Resizable Horizontal, Vertical and Nested shown.
- Minimum sizes noted on each panel.
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | To the handle. |
| ArrowRightArrowLeft | Moves the handle in steps; in Arabic ArrowLeft widens the first panel. |
| ArrowDownArrowUp | In a vertical group. |
| HomeEnd | To the first panel's smallest and largest size. |
ARIA
- The handle is a focusable
role="separator"witharia-valuenow,aria-valuemin,aria-valuemax(the first panel's size) andaria-controls. - Its 48px drag area covers 24px of each panel, inside their padding.
Arabic and RTL notes
Mirrors
- The first panel sits on the right.
- Dragging and arrow keys follow the reading direction.
Does not mirror
- Vertical groups don't change, and the grip dots don't mirror.
- Numerals
- Sizes you show follow the numerals setting in your UI.
- Arabic typography
- The group sets no type; panels bring their own content.
- Mixed-direction text
- Ritla UI builds its own splitter because the common alternatives hard-wire ArrowLeft to shrink the first panel, even in Arabic.
Do
- The RTL variants, so the panel order mirrors.
- Check that the first panel is still the primary one.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)