Splitter

Panels side by side or stacked, with a gutter between each two that users drag or move with the keyboard to share the space. Use it for master–detail views, editors with a sidebar or a console.

  • vig-splitter
  • vig-splitter-panel
Import
import { Splitter, SplitterPanel } from '@vigdx/ui/splitter';

Basic

Panel sizes are percentages of the space the panels share, two-way bound with [(sizes)] ; without them the panels share it equally. minSize (percent) is the least a panel can have, also for bound and restored sizes. Panels added or removed later keep the others' shares. Give a splitter a height; a panel scrolls its own overflow. Panels must be the splitter's own content ( @if and @for are fine), not part of another component's template.

Navigation

Content

Sizes: 30% / 70%

Nested and collapsible

A vertical splitter inside a panel of a horizontal one. collapsible panels collapse with Enter on their gutter or when dragged below half their minimum; Enter again restores the size they had.

Explorer (collapsible: Enter on its gutter)

Editor

Terminal

Remembered sizes

state keeps the sizes the user set: a key for localStorage , or { key, storage } with 'session' or any storage object (the same storages as vig-table's state ). They are restored in the browser after the first render (or once the panels arrived), so server-rendered and hydrated markup match; every storage, custom ones too, keeps them under vig-splitter:<key> . (resized) reports the sizes once a drag or key press ended.

Resize me, then reload the page.

The sizes come back from localStorage.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="splitter"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Splitter [data-scope="splitter"]

Splitter styling hooks
Part Element data-state
root The vig-splitter host; also carries data-orientation ( horizontal , vertical ). —

SplitterPanel [data-scope="splitter"]

SplitterPanel styling hooks
Part Element data-state
gutter The role="separator" before every panel but the first. dragging
handle The grip drawn in the gutter. —
panel The sized, scrolling panel. expanded, collapsed

Accessibility

  • Each gutter is a WAI-ARIA APG window splitter: a focusable role="separator" whose aria-valuenow is the size of the panel before it (aria-controls), with aria-valuemin and aria-valuemax from the minimum sizes. Name gutters by what they resize with labels.gutterAriaLabel on the splitter or on the panel before the gutter.
  • Arrow keys move a gutter by step percent (Left/Right when horizontal, mirrored in RTL; Up/Down when vertical), Shift by five steps, Home and End to the least and greatest size; Enter collapses and restores a collapsible panel next to it.
  • Pointer drags use pointer capture; only the gutter blocks touch scrolling (touch-action: none). Its hit area is 24px wide, 44px on coarse pointers, and reaches into the panel after it only, so the scrollbar of the panel before it stays grabbable. The gutter's handle is drawn with borders, so it stays visible in forced-colors mode.
  • A collapsed panel is hidden (visibility: hidden), so its content leaves the tab order and the accessibility tree; focus inside it moves to the gutter next to it.

API

Splitter

vig-splitter component

Lays out its vig-splitter-panels side by side (horizontal, mirrored in RTL) or stacked (vertical) with a draggable gutter between each two. Sizes are percentages of the space the panels share, two-way bound with [(sizes)]; without them the panels share it equally.

Example :
<vig-splitter [(sizes)]="sizes" style="height: 20rem">
  <vig-splitter-panel [minSize]="20">Navigation</vig-splitter-panel>
  <vig-splitter-panel>Content</vig-splitter-panel>
</vig-splitter>

Each gutter is an APG window splitter (role="separator" with its value the size of the panel before it): arrows move it by step (Shift: five steps), Home and End move it to the least and the greatest size, Enter collapses and restores a collapsible panel next to it. Pointers drag it (pointer capture; a 24px hit area, 44px on coarse pointers); dragging a collapsible panel below half its minSize collapses it. Sizes render from the inputs, identically on the server; a state key restores the user's sizes in the browser after the first render.

Panels must be the splitter's own content (or content of it in @if and @for blocks), not elements of another component's template. When panels come and go, the remaining ones keep their share and a new one takes its minSize (or an equal share); minSize holds for bound, restored and initial sizes too.

Splitter props
Name Type Default Description
labelsPartial<SplitterLabels>—

Texts (i18n): the gutters' accessible name; a panel's labels win for the gutter after it.

orientationSplitterOrientation'horizontal'

horizontal (default): panels side by side; vertical: stacked (give the splitter a height).

sizes model readonly number[][]

Panel sizes in percent; two-way bindable. Equal shares while it does not match the panels.

stateSplitterStateOptions | undefinedundefined

Keeps the sizes the user set across visits: a storage key (localStorage), or { key, storage }. Restored in the browser right after the first render, so server and hydrated markup match.

stepnumber2

Percent an arrow key moves a gutter (Shift: five times as much).

SplitterPanel

vig-splitter-panel component

One panel of a vig-splitter. Its size comes from the splitter's sizes; minSize (percent) is the least the user can resize it to and collapsible lets Enter on the gutter (or a drag below half the minimum) collapse it to 0. Each panel after the first renders the gutter before it; the panel scrolls its own overflow.

SplitterPanel props
Name Type Default Description
collapsiblebooleanfalse

Enter on the gutter, or a drag below half minSize, collapses the panel to 0.

labelsPartial<SplitterPanelLabels>—

Texts (i18n): the name of the gutter after this panel, e.g. "Resize navigation".

minSizenumber0

Least size in percent while expanded (default 0).

Are you sure?