Splitter
vig-splitter vig-splitter-panel
import { Splitter, SplitterPanel } from '@vigdx/ui/splitter';Basic
[(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
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"]
| Part | Element | data-state |
|---|---|---|
root | vig-splitter host; also carries data-orientation ( horizontal , vertical ). | — |
SplitterPanel [data-scope="splitter"]
| Part | Element | data-state |
|---|---|---|
gutter | role="separator" before every panel but the first. | dragging |
handle | — | |
panel | expanded, collapsed |
Accessibility
- Each gutter is a WAI-ARIA APG window splitter: a focusable
role="separator"whosearia-valuenowis the size of the panel before it (aria-controls), witharia-valueminandaria-valuemaxfrom the minimum sizes. Name gutters by what they resize withlabels.gutterAriaLabelon the splitter or on the panel before the gutter. - Arrow keys move a gutter by
steppercent (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-splitterLays 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.
<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.
| Name | Type | Default | Description |
|---|---|---|---|
labels | Partial<SplitterLabels> | — | Texts (i18n): the gutters' accessible name; a panel's |
orientation | SplitterOrientation | 'horizontal' |
|
sizes | readonly number[] | [] | Panel sizes in percent; two-way bindable. Equal shares while it does not match the panels. |
state | SplitterStateOptions | undefined | undefined | Keeps the sizes the user set across visits: a storage key
( |
step | number | 2 | Percent an arrow key moves a gutter (Shift: five times as much). |
| Name | Payload | Description |
|---|---|---|
resized | SplitterResizeEvent | A drag or key press moved a gutter, or Enter collapsed or restored a panel. |
sizesChange | readonly number[] | Panel sizes in percent; two-way bindable. Equal shares while it does not match the panels. |
SplitterPanel
vig-splitter-panelOne 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.
| Name | Type | Default | Description |
|---|---|---|---|
collapsible | boolean | false | Enter on the gutter, or a drag below half |
labels | Partial<SplitterPanelLabels> | — | Texts (i18n): the name of the gutter after this panel, e.g. "Resize navigation". |
minSize | number | 0 | Least size in percent while expanded (default 0). |