Components · Layout
Resizable
Columns or rows whose split people drag, with the drag handle sitting on the seam between them.
Also called Split view, Splitter, Resize handle
import { Resizable } from "@botiverse/raft-ui";Resizable lets people drag the boundary between two regions to change how much room each one gets: the sidebar and the main area, or a conversation and its thread. The seam between the two columns is the only line, and the drag handle sits on it (Composites).
When to use
| Situation | Use |
|---|---|
| A split people adjust: the sidebar, the thread panel | Resizable |
| Widths fixed by the design | The slots of AppShell, or plain layout |
| A side panel that opens and closes beside the main area | A Panel in the shell |
| Details that cover the page for a while | Drawer |
Anatomy
ResizableGroup: the container.orientation="horizontal"(the default) puts its panels side by side;orientation="vertical"stacks them. Required.ResizablePanel: one region, with its default, minimum and maximum size. At least 2.ResizableHandle: the drag handle between two panels. Required between every adjacent pair: a group without handles is plain layout.
The panels draw no surface, edge or padding. The region inside each panel draws its own, including the one seam between the two (Page structure).
States
| State | Look |
|---|---|
| At rest | Nothing: the seam drawn by the region shows where the handle is |
| Hover, dragging | A 1px foreground-muted line over the seam, and a resize cursor |
| Keyboard focus | A 2px foreground line over the seam |
Behavior
- The handle is 12px wide and centered on the boundary, overlapping each panel by 6px, so it takes no room from either.
- Use the widths in Spacing for the default, minimum and maximum: the sidebar and the thread panel each have their own range.
- Pass
groupResizeBehavior="preserve-pixel-size"on the sidebar's panel, so the sidebar keeps its width when the window changes and the main area takes up the difference. - Below 768px there are no side-by-side columns to resize (Responsive layout).
Accessibility
- Resizable wraps react-resizable-panels. Each
ResizableHandleis a focusableseparatorwitharia-valuenow,aria-valuemin,aria-valuemaxandaria-controls. - Keyboard: the arrow keys along the group's orientation resize in small steps, Home and End go to the minimum and the maximum, Enter collapses or restores a collapsible panel, and F6 moves to the next handle.
- Give every handle an
aria-labelthat says what it resizes: "Resize sidebar".
Rules
- Use Resizable only for splits people adjust. Don't wrap fixed layouts in a group in case they might be resized later.
- Don't draw a line on the handle or a second edge on the panels: the seam of the region is the only line.
API
ResizableGroup, ResizableHandle, ResizablePanel
Takes the attributes of its element.
Related
Changes
- 0.0.21 · AddedAdded generic
ResizableGroup,ResizableHandle, andResizablePanelprimitives for resizable panel layouts.