import { Component } from '@angular/core';
import { WrSplitter } from 'ngwr/splitter';
@Component({ imports: [WrSplitter] })
export class MyComponent {}Splitter
Two panes with a divider the user drags or moves with the arrow keys.
Installation
Import the class, and @use the entry point in your global styles: without it the component renders unstyled.
Horizontal
Give the splitter a height; bind [(position)], a percentage from 0 to 100.
<wr-splitter [(position)]="pos" style="height: 20rem">
<div wrSplitterStart>Files</div>
<div wrSplitterEnd>Editor</div>
</wr-splitter>Vertical
wrSplitterStart is the top pane; position is measured from the top.
<wr-splitter [(position)]="pos" orientation="vertical" style="height: 20rem">
<div wrSplitterStart>Preview</div>
<div wrSplitterEnd>Logs</div>
</wr-splitter>API
| Name | Description | Type | Default |
|---|---|---|---|
position | Position of the divider as a percentage (0–100). Two-way bindable. | number | 50 |
orientation | Divider direction: - 'horizontal' — vertical divider, drags L/R (panes side by side). - 'vertical' — horizontal divider, drags U/D (panes stacked). | 'horizontal' | 'vertical' | 'horizontal' |
minPosition | Minimum allowed position. | number | 0 |
maxPosition | Maximum allowed position. | number | 100 |
disabled | Disable dragging. | boolean | false |
dividerLabel | Accessible name of the divider. A focusable role="separator" is an interactive widget, so it needs one — without it a screen reader reaching the divider announces nothing but "separator" and its number. Falls back to splitter.divider. | string | null | null |
CSS variables
Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/splitter's own element.
| Variable | Default | Declared on |
|---|---|---|
--wr-splitter-divider-bg | var(--wr-border-base) | .wr-splitter |
--wr-splitter-font-family | var(--wr-font-family-base) | .wr-splitter |
--wr-splitter-handle-border | var(--wr-border-base) | .wr-splitter |
--wr-splitter-handle-radius | var(--wr-control-radius-sm) | .wr-splitter |