Components · Layout
PaneGrid
How panes are laid out — columns side by side, a column split top and bottom, a pane folded to its tab bar, and one pane maximized — with sizes in px kept by the caller.
Also called Split view, Editor grid, Pane layout
import { PaneGrid } from "@botiverse/raft-ui/wip";PaneGrid lays out panes: columns side by side, or, nested with orientation="vertical", a column split top and bottom. A pane can be folded to its tab bar, and one pane can be maximized. It is built on Resizable; the sizes are px the caller keeps, and the grid only reports a seam someone dragged (Tabs and panes).
When to use
Anatomy
- The grid: a
ResizableGroupofcells, with aResizableHandleon each seam. - A cell: an
id, its savedsizein px, itsminandmax, and itscontent.fixedfolds it to its tab bar: fixed at its size, with no handle on either side.dataputsdata-*attributes on it for the app's hit-testing.
Behavior
onResizegets each cell's new size in px, as asked for before a narrow window clamped it, only when someone drags a seam. A layout the grid makes itself, for a narrower window, never changes the saved sizes.layoutKeychanges when the structure changes (a pane added or folded, the window's width): the grid lays out again from the saved sizes.maximizedfills the grid with one cell and hides the others; a cell withkeepWhenMaximizedstays on screen at its size beside it. The maximized cell's content gets the new width.- Maximizing, restoring and a new
layoutKeylay the grid out anew, so the cells' content mounts again. Keep what must live on outside the grid: the shell lays pages over the panes from a fixed layer, and keeps tabs and drafts in its own state (Tabs and panes). - A cell's least size is 160px for a column, a tab bar's height for a folded pane: content under its own least width is clipped, not squeezed.
Accessibility
- Each seam is a focusable separator: the arrow keys resize. Name it with
messages.resize(Resize by default).
Rules
- Keep up to 4 columns, and each pane split top and bottom at least 200px tall.
- Save only the sizes people dragged.
API
PaneGrid
How panes are laid out: columns side by side, a column split top and bottom, and one pane maximized. Built on `ResizableGroup`, `ResizablePanel` and `ResizableHandle`: a seam is a focusable separator the arrow keys move. Sizes are px kept by the caller; the grid only reports a dragged seam.