Reference

PanelGroup

Panels side by side (or .vertical, one above another) with a handle between each two that resizes them: dragged, or the arrow keys on it. bind: holds their sizes in percent — a persist keeps them across visits — and on resize(e) hears them as e.detail.

PanelGroup(bind: State, vertical: Bool, label: String) { … }

Since 6.2.0

label

Sizes: 30% and 70%

Inbox

Archive

Spam

Drag the handle, or use the arrow keys on it.

Example

wf

state sizes: [Number] = [30, 70] Text("Sizes: {sizes[0] ?? 0}% and {sizes[1] ?? 0}%").muted.sm PanelGroup(bind: sizes, label: "Resize the sidebar") { style { height: 200px; border: 1px solid $color-border; border-radius: $radius-md } PanelGroup.Panel(min: 15) { Stack(gap: .xs) { style { padding: 0.75rem } Text("Inbox").bold Text("Archive") Text("Spam") } } PanelGroup.Panel(min: 40) { Text("Drag the handle, or use the arrow keys on it.") { style { padding: 0.75rem } } } }

One above another, a panel that folds away

wf

state split: [Number] = [60, 40] PanelGroup(bind: split, label: "Resize the output").vertical { style { height: 300px } PanelGroup.Panel { Text("Source") } PanelGroup.Panel(collapsible: true) { Text("Output") } }

Kept across visits

wf

persist widths: [Number] = [25, 50, 25] PanelGroup(bind: widths, label: "Resize the columns") { style { height: 160px } PanelGroup.Panel { Text("Files") } PanelGroup.Panel { Text("Editor") } PanelGroup.Panel { Text("Outline") } }

Props

Props of PanelGroup
PropTypeUnsetMeaning

bind:

State

equal shares

A list of Numbers, each panel's size in percent, [30, 70], written as they move; a list of another length is ignored

vertical:

Bool

false: side by side

Panels one above another; the handles move up and down. Written as a flag, .vertical, or vertical: true.

label:

String

Resize

Each handle's accessible name (aria-label): what it resizes

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

.vertical

Events

Events of PanelGroup
EventSendsMeaning
on resize—

Every element also takes the props, the events and the attribute families listed on every element.

Slots

children

Parts

The parts of PanelGroup are written under its name, inside it. Each is described here, with what it takes.

PanelGroup.Panel

One panel.

PanelGroup.Panel(min: Number, collapsible: Bool) { … }
Props of PanelGroup.Panel
PropTypeUnsetMeaning

min:

Number

10

The least it may be, in percent of the group

collapsible:

Bool

false

Enter or a double press on the handle after it folds it away, its share to its neighbour; again brings it back. Written as a flag, .collapsible, or collapsible: true.

.collapsible

Renders with the class wf-panel-group, stable across releases, so a stylesheet may target it.