Skip to content

Splitter for Angular

AngularLayout

Two or more resizable panes, side by side or stacked, following the WAI-ARIA APG window splitter: each separator is a focusable role=separator with aria-valuenow, min, and max, moved by dragging or by arrow keys, Home, and End; Enter collapses and restores a collapsible pane, and a double-click resets the sizes. Min and max sizes take pixels or percentages; splitters nest. The component stores nothing: sizes are reported in aui-change for the application to persist.

  • APG window splitterFocusable separators with values, arrow keys, Home and End, and Enter to collapse.
  • Pixels or percentInitial, minimum, and maximum sizes in pixels or percentages, kept on resize.
  • Collapsible panesCollapse with Enter or by dragging past half the minimum; restore to the previous size.
  • Nested and RTLHorizontal and vertical splitters nest; horizontal ones mirror in right-to-left layouts.
  • You own persistenceaui-change reports the sizes; pass them back as sizes. Nothing is stored by the component.

Behavior, design tokens, and limitations are described on the Splitter page; this page covers the Angular API.

import { Component } from '@angular/core';
import type { SplitterPane } from '@absoluteui/components/splitter';
import { AuiSplitter } from '@absoluteui/angular/splitter';
function pane(text: string): HTMLElement {
const el = document.createElement('div');
el.textContent = text;
return el;
}
@Component({
selector: 'app-workspace',
imports: [AuiSplitter],
template: `<aui-splitter [panes]="panes" [(sizes)]="sizes"></aui-splitter>`,
})
export class WorkspaceComponent {
readonly panes: SplitterPane[] = [{ content: pane('Files'), label: 'Files', size: '25%', min: 160, collapsible: true }, { content: pane('Editor'), label: 'Editor', min: 320 }];
sizes: number[] | null = null;
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiSplitter } from '@absoluteui/angular/splitter';

Defaults for every instance: provideAbsoluteUIConfig({ components: { splitter: { ... } } }) (see Configuration).

Class AuiSplitter; template reference #ref="auiSplitter".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
panes readonly SplitterPane[] Required. Two to ten panes: { content: Node, label, size?, min?, max?, collapsible?, collapsed? }; lengths in px (number or ‘240px’) or ‘%’.
orientation SplitterOrientation 'horizontal' horizontal: panes side by side (vertical separators); vertical: stacked panes.
step number '16' Pixels a separator moves per arrow key press.
locale string 'en-US' Locale of the collapsed-state text.
Model Type Change output Description
[(sizes)] readonly number[] | null (sizesChange) Restored sizes in percent per pane (from aui-change); overrides the panes’ size.
Output Payload Description
(changed) SplitterChangeDetail The user resized, collapsed, expanded, or reset: { sizes, collapsed, index, reason }; persist sizes and pass them back as sizes. Re-emits aui-change.

Call them through a viewChild query or a template reference.

Method Description
collapse(index: number): void Collapse a collapsible pane (no event).
expand(index: number): void Restore a collapsed pane (no event).
reset(): void Back to the initial sizes and collapsed states (no event).

Pattern: WAI-ARIA APG Window Splitter (variable): each separator is a focusable role=separator whose value is the size of the pane before it in percent; arrow keys move it, Home and End go to the limits, Enter collapses and restores.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Splitter: Accessibility and performance.