Skip to main content

Split pane

Two panes with a draggable, keyboard-resizable separator.

editor
results
<mm-split-pane default-position="280" storage-key="query.tree" label="Resize source tree">
<nav slot="start" aria-label="Sources">…</nav>
<mm-split-pane slot="end" orientation="vertical" default-position="240" storage-key="query.editor" label="Resize editor">
<div slot="start">editor</div>
<div slot="end">results</div>
</mm-split-pane>
</mm-split-pane>

Guidance​

A split pane puts two related panes side by side (or one above the other) with a hairline separator people can drag: the source tree beside the editor and results in Query, or the term list beside the article in Glossary. The separator is a 1px mm-rule line with a wider grab area; it darkens on hover, while dragging and on focus. Panes are never boxed: the hairline is the only structure.

The size of the start pane is kept in pixels between min-start and the container size less min-end. With storage-key it is remembered in localStorage. Double-clicking the separator returns it to default-position and forgets the stored size.

Keyboard (https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/): the separator is a focusable role="separator" with aria-valuenow, aria-valuemin and aria-valuemax. Left and Right (or Up and Down when stacked) move it by 16px, flipped in right-to-left layouts so the arrow always points the way the separator moves. Home and End move it to the minimum and maximum.

Properties​

PropertyAttributeTypeDefaultDescription
orientationorientation'horizontal' | 'vertical''horizontal'horizontal (default) puts the panes side by side; vertical stacks them.
positionpositionnumber | undefinedSize of the start pane in pixels. Set it to control the split; it updates as people resize.
defaultPositiondefault-positionnumber280Start pane size in pixels before anything is stored, and after a double-click reset.
minStartmin-startnumber200Smallest start pane, in pixels.
minEndmin-endnumber240Smallest end pane, in pixels.
storageKeystorage-keystring''localStorage key that remembers the position. Leave empty to not persist.
labellabelstring''Accessible name of the separator, naming what it resizes ("Resize source tree").

Events​

EventDetailDescription
mm-resizeCustomEvent<{ position: number }>The start pane was resized by pointer or keyboard, in pixels.

Slots​

SlotDescription
startThe first pane (inline start, or top when stacked).
endThe second pane.

CSS parts​

PartDescription
startThe start pane wrapper.
endThe end pane wrapper.
separatorThe separator.

Examples​

Every state of mm-split-pane in Storybook, with keyboard and screen reader tests.