GPUI Deck

Resizable

Multi-panel sizes, cascading pointer/keyboard resizing, per-panel fractional and pixel limits, collapsible panels, retained sizes, and native splitter semantics.

Rendered by GPUI’s web backend from the real component. Requires a browser with WebGPU.

Resizable divides a bounded frame into two or more continuously laid out panels separated by focusable dividers. Its state owns panel sizes, each panel's constraints, and one focus handle per divider:

let split = cx.new(|cx| {
    ResizableState::new(
        Axis::Horizontal,
        [
            ResizablePanel::new(0.25).limits(0.15..=0.4).collapsible(0.),
            ResizablePanel::new(0.5).limits(0.3..=1.),
            ResizablePanel::new(0.25).limits(0.15..=0.4),
        ],
        cx,
    )
});

Resizable::new("workspace", &split)
    .size_full()
    .panel(sidebar)
    .panel(editor)
    .panel(inspector)
    .handle(|index, handle| {
        handle
            .accessibility_label(["Sidebar width", "Editor width"][index])
            .w(px(6.))
            .bg(divider_color)
    })

Supply one panel per configured panel, in order. handle builds every divider from its index, which is the index of the panel before it. Axis::Horizontal places panels left to right and uses the handle's width; Axis::Vertical places them top to bottom and uses its height. Bound the frame's dimensions and give handles an actual thickness. Sizes are fractions of the usable space after divider thicknesses, sum to one, and stay proportional when the parent resizes. Frame padding is supported; the internal layout has no gap.

ResizablePanel::new(default) starts free between zero and one. limits bounds the expanded size and collapsible(size) allows a smaller collapsed size. Constructing a state panics when defaults violate a panel's constraints or do not sum to one. pixel_limits(min..=max) adds logical-pixel bounds that apply once the group is measured; the tighter of the fractional and pixel bound wins. When the measured space changes, a layout that breaks the new bounds is refitted once, nearest first, and emits a Change; a still-valid layout keeps its proportions. If the space cannot satisfy every pixel limit, the group uses the fractional limits alone until it can. Divider values and Home/End reflect the measured bounds.

Moving a divider grows the panel on one side and shrinks the panels on the other side nearest first, so a panel at its minimum passes the move to the next one. A move no panel can absorb leaves the divider in place. Dragging past halfway between a collapsible panel's minimum and collapsed size snaps it closed; dragging back past that point reopens it at its minimum.

InputResult
Drag a dividerResize from the actual press position, cascading within constraints
Left / Right in a horizontal groupShrink / grow the panel before the divider by two percentage points
Up / Down in a vertical groupShrink / grow the panel before the divider by two percentage points
Arrow toward a collapsed panelReopen it at its minimum
Arrow against a collapsible panel at its minimumCollapse it
Home / EndGive the panel before the divider its smallest / largest allowed size
EnterCollapse a collapsible panel before the divider, or restore its last size
Tab / Shift+TabTraverse dividers and panel controls in ordinary document order

Home, End and Enter follow the APG window splitter pattern. Only dividers own the resize key context. Text editing, selection, and scrolling inside panels retain their own behavior. Pointer dragging uses GPUI's drag lifecycle and identifies its owning state and divider, so independent or nested groups do not react to another divider's drag.

Each divider has a native Splitter role whose numeric value, limits, and step describe the panel before it, in percent. Native orientation describes the divider line. Give each divider a label naming the panel it adjusts and keep its grip children non-interactive. The application supplies all styling.

A panel collapsed to zero size unmounts its content, so it contributes no focus stops or accessibility nodes. If focus was inside, it moves to the adjacent divider (or the group itself while resizing is disabled). A non-zero collapsed size, such as an icon rail, keeps its content mounted.

Observe the state to update presentation. sizes(), panel_count(), is_collapsed(index), axis(), handle_focus(index), and is_disabled() expose its contract. set_sizes replaces the whole layout and panics on an invalid one, then fits it to the measured pixel limits. To persist a layout, store sizes() from ResizableEvent::Change in application storage and pass it to set_sizes on the next launch. collapse(index) and expand(index) act on collapsible panels and do nothing when the neighbors cannot absorb the change. Each layout change emits one ResizableEvent::Change(sizes), including programmatic updates. set_disabled blocks pointer, keyboard, and accessibility resizing and normal Tab entry; a focused divider retains its binding so Tab can leave.

The Schedule example puts the shared notes in a collapsible first panel and the plan table in a two-axis ScrollArea in the second, which keeps at least 96 px. Closing or switching tabs preserves text and sizes because the application retains their states. The library writes no files; the storage location belongs to the application.