Create

Layout

Resizable

Copy page View as Markdown Open in ChatGPT Open in Claude

Panel groups and layouts that the user resizes by dragging the dividers or with the keyboard.

Usage#

app.component.ts
import { WDS_RESIZABLE } from '@wds/angular/resizable';

Examples#

Default#

Inbox
Message

Horizontal#

Panels side by side, split 25 to 75, with a plain 1px divider. Sizes are percentages of the group.

Folders
Files

Vertical#

orientation="vertical" stacks the panels; the divider is dragged up and down.

Query
Results

Nested#

A wds-resizable inside a panel splits it again, also in the other direction. indicator="grip" draws a short bar on the divider.

Map
Filters
Stations

Pill indicator#

indicator="pill" draws a pill that grows on hover and turns primary while dragging.

Outline
Document

Three panels#

Every panel has min-size. A panel at its minimum passes the rest of the move on to the next panel.

Layers
Canvas
Properties

Collapsible#

A collapsible panel dragged below half of min-size snaps to collapsed-size; Enter on the handle collapses and expands it. The panel fires wds-collapse and wds-expand and has collapse() and expand().

Navigation
Workspace

Size tracking#

wds-input fires on every move and wds-change once the pointer is released. layout in the detail holds the sizes keyed by the id of each panel; to restore a saved layout, pass it to default-size or setLayout().

30%
70%

API References#

wds-resizable#

Resizable panel group: wds-resizable-panel elements separated by wds-resizable-handle elements, laid out in a row (horizontal) or a column (vertical). Sizes are percentages of the group. To split a panel again, put another wds-resizable inside it. The group fills its container (width and height 100%); give it or its container a height.

Attributes

AttributeTypeDefaultDescription
orientationWdsResizableOrientation'horizontal'horizontal: panels side by side. vertical: panels stacked.
keyboard-step.keyboardStepnumber10Step of the arrow keys on a handle, in percent.
disabledbooleanfalseNo handle can be dragged or moved with the keyboard.

Events

EventDescription
wds-inputCustomEvent<WdsResizableLayoutDetail>Every change of the layout while dragging.
wds-changeCustomEvent<WdsResizableLayoutDetail>A committed change: the pointer is released, or a key changed the layout.

Methods

MethodDescription
setLayout(sizes: number[])Sets the sizes of all panels in percent (scaled to add up to 100). Does not fire events.

Slots

SlotDescription
(default)wds-resizable-panel and wds-resizable-handle elements.

wds-resizable-panel#

One panel of wds-resizable. Sizes are percentages of the group; the group sets the current size from default-size and from the handles. A collapsible panel dragged below half of min-size snaps to collapsed-size.

Attributes

AttributeTypeDefaultDescription
default-size.defaultSizenumber | undefinedStarting size in percent. Panels without it share the rest equally.
min-size.minSizenumber0Smallest size in percent.
max-size.maxSizenumber100Largest size in percent.
collapsiblebooleanfalseDragged below half of min-size, the panel collapses to collapsed-size.
collapsed-size.collapsedSizenumber0Size of a collapsed panel in percent.

Events

EventDescription
wds-collapseCustomEvent<void>The panel collapsed (collapsible).
wds-expandCustomEvent<void>A collapsed panel expanded.

Methods

MethodDescription
collapse()Collapses the panel (collapsible).
expand()Expands a collapsed panel to its size before collapsing (or min-size).
resize(size: number)Sets the size in percent; the neighbours give or take the difference.

Slots

SlotDescription
(default)Content of the panel. To split it again, put another wds-resizable inside.

wds-resizable-handle#

The divider between two panels of wds-resizable. Drag it, or focus it and use the arrow keys. It is a separator that reports the size of the panel before it.

Attributes

AttributeTypeDefaultDescription
indicatorWdsResizableHandleIndicator'none'Mark drawn on the line: grip (a short bar) or pill (grows on hover and while dragging).
disabledbooleanfalseThe handle cannot be dragged or moved with the keyboard.
labelstring''Accessible name. Empty: built-in text (resizable.handle).

CSS parts (::part)

PartDescription
indicatorThe grip or pill drawn on the line (indicator).

CSS custom properties

PropertyDescription
--wds-resizable-handle-colorColor of the line (default --wds-border).

Accessibility#

Screen reader#

Each wds-resizable-handle is a focusable separator named by label (default Resize panels). Its aria-valuenow, aria-valuemin and aria-valuemax are the size of the panel before it and that panel’s limits, in percent; aria-controls points to that panel.

aria-orientation is perpendicular to the group: the handles of a horizontal group are vertical separators.

A disabled handle (disabled on the handle or on the group) leaves the tab sequence and gets aria-disabled="true".

Keyboard support#

KeyFunction
TabMoves focus to the next handle.
←→In a horizontal group, shrinks or grows the panel before the handle by keyboard-step (10% by default).
↑↓In a vertical group, shrinks or grows the panel above the handle.
HomeShrinks the panel before the handle to its minimum (or collapses it when it is collapsible).
EndGrows the panel before the handle to its maximum.
EnterCollapses or expands the panel before the handle when it is collapsible.
Footer