# Split

The **split** component enables the division of the content area in two or more distinct sections, with a draggable handlebar between them. Parts can be resized, collapsed and expanded accordingly.

## Usage

![Split](<../images/split.png>)

The split component allows the creation of dynamic layouts, divided in adjacent panes. Each pane can contain a variety of components, such as tables, lists, images, or maps. Panes are separated by the handlebar that support a dragging action for resizing.

### When to use

- Use it when the content needs to be divided in different sections, allowing users some freedom in regards of viewport arrangement (e.g. give more space to a map or a table).
- Use it when part of the content needs to be hidden or being partially reduced in size so users can focus on their current task.
- Use it when all sections are relevant in combination to each other.

### Best practices

- Be mindful about its use. Content can quickly become overly partitioned, increasing the interaction cost. Don't split the content in more than three sections.
- Define minimum and maximum pane sizes. Make sure to use sizes that keep the handlebar visible. If a pane gets too small, it can become too difficult to interact with.
- Allow users to hide a pane when it makes sense. E.g: If a design includes an edit function, consider letting users hide other panes to reduce distractions.

## Design

### Elements

![Split elements](<../images/split-elements.png>)

> 1. Title (optional), 2. Pane, 3. Handlebar, 4. Additional actions (optional), 5. Expanse/collapse button (optional)

Panes are structural placeholders that divide content into sections. According to the [layout guidelines](<https://element.siemens.io/fundamentals/layouts/overview/>), content should be grouped into cards with 4px rounded corners.

Given that panes are used to organize content, the same principle applies. To maintain consistency, use the [card component](<https://element.siemens.io/components/layout-navigation/cards/>) inside panes. If that's not feasible, apply the `element-radius-2` class for 4px rounded corners to align with design standards.

### Layout orientation

The component can be use to divide the screen horizontally, vertically or both. The orientation should be chosen based on the content type and the to be expected screen size.

![Split orientation](<../images/split-orientation.png>)

### Resizable containers

Users can change a pane's width or height by sliding the handlebar in either direction.

![Split resize](<../images/split-resize.png>)

### Expand and collapse

Optionally, panes can be expanded or collapsed to show or hide information, if the application allows said actions.

![Split expand and collapse](<../images/split-expanded-collapsed.png>)

### Responsive layout

Ensure that the chosen layout works well on all device types. For small screen sizes, consider changing the layout to an interactive one where users can switch between panes. See the [list-details](<https://element.siemens.io/components/layout-navigation/list-details/>) pattern's responsive behavior as an example.

## Code

### Usage

`si-split` can be imported using the module

```
import { RouterModule } from '@angular/router';

import { SiSplitModule } from '@siemens/element-ng/split';

@NgModule({
  imports: [SiSplitModule, RouterModule, ...]
})
```

or as a standalone component:

```
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';

@Component({
  imports: [
    SiSplitComponent,
    SiSplitPartComponent,
    ...
  ]
})
```

### Sizing

Each `si-split-part` requires a numeric `size` and a `unit`. Use `unit="fr"` for a part that should scale with the available space. Use `unit="px"` for a part that should keep a fixed size while the split container changes size.

### Horizontal collapsed heading direction

In a horizontal split, the title of a collapsed part is displayed vertically. To change its direction so it faces the start, add the `align-heading-start` class to the `<si-split-part>`. This class only affects the title while the part is collapsed in a horizontal split.

```
<si-split-part heading="..." collapsible="to-start" class="align-heading-start">...</si-split-part>
```

### Horizontal split with fractional sizing

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import {
  SiSplitComponent,
  SiSplitPartComponent,
  SplitOrientation
} from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-auto.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
  orientation: SplitOrientation = 'horizontal';
  showDetails = true;
}
```

Template:

```html
<div class="h-100 si-layout-fixed-height">
  <div>
    <button type="button" class="btn btn-primary mb-4" (click)="showDetails = !showDetails">
      Toggle details
    </button>
  </div>
  <si-split class="si-layout-fixed-height" [orientation]="orientation">
    <si-split-part
      heading="Filters"
      collapsible="to-start"
      class="background-1 align-heading-start"
      size="20"
      unit="fr"
      [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
      [minSize]="100"
    >
      <p class="p-4 text-secondary">Split Part #1</p>
    </si-split-part>

    <si-split-part
      heading="Employees"
      collapsible="to-start"
      class="background-1"
      size="60"
      unit="fr"
    >
      <div class="si-layout-fixed-height justify-content-center background-information-subtle">
        <p class="text-center">Split Part with resizable content!</p>
      </div>
    </si-split-part>

    @if (showDetails) {
      <si-split-part
        heading="Details"
        collapsible="to-end"
        class="background-1"
        size="20"
        unit="fr"
      >
        <p class="p-4 text-secondary">Split Part #3</p>
      </si-split-part>
    }
  </si-split>

  <p class="mt-8">
    <button type="button" class="btn btn-primary me-6" (click)="orientation = 'vertical'"
      >Set to vertical</button
    >
    <button type="button" class="btn btn-primary me-6" (click)="orientation = 'horizontal'"
      >Set to horizontal</button
    >
  </p>
</div>
```

### Horizontal split with mixed fixed and fractional sizing

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { PartState, SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-mixed.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);

  format(name: string, state: PartState): any {
    return Object.assign({ name }, state);
  }
}
```

Template:

```html
<si-split orientation="horizontal" stateId="split-mixed" style="height: 300px">
  <si-split-part
    heading="Filters"
    stateId="filters"
    collapsible="to-start"
    class="background-1"
    size="200"
    unit="px"
    [actions]="[
      { iconClass: 'element-edit', click: logEvent, tooltip: 'edit' },
      { iconClass: 'element-delete', click: logEvent, tooltip: 'delete' }
    ]"
    (stateChange)="logEvent(format('left', $event))"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part heading="Employees" stateId="employees" class="background-1" size="1" unit="fr">
    <si-split orientation="vertical" stateId="vertical-split">
      <si-split-part
        stateId="middle-top"
        class="background-1"
        size="100"
        unit="px"
        [showHeader]="false"
        (stateChange)="logEvent(format('middle', $event))"
      >
        <p class="p-4 text-secondary">Split Part #2.1</p>
      </si-split-part>
      <si-split-part
        stateId="middle-bottom"
        class="background-1"
        size="1"
        unit="fr"
        [showHeader]="false"
      >
        <p class="p-4 text-secondary">Split Part #2.2</p>
      </si-split-part>
    </si-split>
  </si-split-part>

  <si-split-part
    heading="Details"
    stateId="details"
    collapsible="to-end"
    class="background-1"
    size="200"
    unit="px"
    (stateChange)="logEvent(format('right', $event))"
  >
    <p class="p-4 text-secondary">Split Part #3</p>
  </si-split-part>
</si-split>
```

### Vertical split

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-vertical.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
}
```

Template:

```html
<si-split orientation="vertical" style="height: 500px">
  <si-split-part
    heading="Filters"
    collapsible="to-start"
    class="background-1"
    size="20"
    unit="fr"
    [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
    [minSize]="250"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part
    heading="Employees"
    collapsible="to-start"
    class="background-1"
    size="60"
    unit="fr"
  >
    <p class="p-4 text-secondary">Split Part #2</p>
  </si-split-part>

  <si-split-part heading="Details" collapsible="to-end" class="background-1" size="20" unit="fr">
    <p class="p-4 text-secondary">Split Part #3</p>
  </si-split-part>
</si-split>
```

### Nested splits

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-nested.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
}
```

Template:

```html
<si-split orientation="horizontal" style="height: 500px">
  <si-split-part
    heading="Outer Left"
    collapsible="to-start"
    class="background-1"
    size="30"
    unit="fr"
    [actions]="[
      { iconClass: 'element-edit', click: logEvent, tooltip: 'edit' },
      { iconClass: 'element-delete', click: logEvent, tooltip: 'delete' }
    ]"
    [minSize]="150"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part
    heading="Outer Right"
    collapsible="to-end"
    class="background-1"
    size="70"
    unit="fr"
  >
    <si-split orientation="vertical">
      <si-split-part
        heading="Inner Top"
        collapsible="to-start"
        class="background-1"
        size="60"
        unit="fr"
        [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'Edit' }]"
      >
        <p class="p-4 text-secondary">Split Part #2</p>
      </si-split-part>
      <si-split-part
        heading="Inner Bottom"
        collapsible="to-end"
        class="background-1"
        size="40"
        unit="fr"
      >
        <p class="p-4 text-secondary">Split Part #3</p>
      </si-split-part>
    </si-split>
  </si-split-part>
</si-split>
```

### Custom collapse icons

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-icons.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
}
```

Template:

```html
<si-split orientation="horizontal" style="height: 300px">
  <si-split-part
    heading="Filters"
    collapsible="to-start"
    class="background-1"
    collapseIconClass="element-login"
    size="20"
    unit="fr"
    [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
    [minSize]="150"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part
    heading="Employees"
    collapsible="to-start"
    class="background-1"
    collapseIconClass="element-fan"
    size="60"
    unit="fr"
  >
    <p class="p-4 text-secondary">Split Part #2</p>
  </si-split-part>

  <si-split-part
    heading="Details"
    collapsible="to-end"
    class="background-1"
    collapseIconClass="element-air"
    size="20"
    unit="fr"
  >
    <p class="p-4 text-secondary">Split Part #3</p>
  </si-split-part>
</si-split>
```

### Hide the collapse button

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-hide-collapse.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
}
```

Template:

```html
<si-split orientation="horizontal" style="height: 300px">
  <si-split-part
    heading="Filters"
    collapsible="to-start"
    class="background-1"
    size="20"
    unit="fr"
    [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
    [minSize]="150"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part heading="Details" class="background-1" size="60" unit="fr">
    <p class="p-4 text-secondary">Split Part #2</p>
  </si-split-part>
</si-split>
```

### Hide the header

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject } from '@angular/core';
import { SiSplitComponent, SiSplitPartComponent } from '@siemens/element-ng/split';
import { LOG_EVENT } from '@siemens/live-preview';

@Component({
  selector: 'app-sample',
  imports: [SiSplitComponent, SiSplitPartComponent],
  templateUrl: './si-split-hide-header.html'
})
export class SampleComponent {
  logEvent = inject(LOG_EVENT);
}
```

Template:

```html
<si-split orientation="horizontal" style="height: 500px">
  <si-split-part
    heading="Filters"
    collapsible="to-start"
    class="background-1"
    size="30"
    unit="fr"
    [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
    [minSize]="150"
  >
    <p class="p-4 text-secondary">Split Part #1</p>
  </si-split-part>

  <si-split-part
    heading="Details"
    size="70"
    unit="fr"
    [actions]="[{ iconClass: 'element-edit', click: logEvent, tooltip: 'edit' }]"
  >
    <si-split orientation="vertical">
      <si-split-part
        heading="Upper"
        collapsible="to-start"
        class="background-1"
        size="60"
        unit="fr"
        [showHeader]="false"
      >
        <p class="p-4 text-secondary">Split Part #2</p>
      </si-split-part>
      <si-split-part
        heading="Lower"
        collapsible="to-start"
        class="background-1"
        size="40"
        unit="fr"
        [showHeader]="false"
      >
        <p class="p-4 text-secondary">Split Part #3</p>
      </si-split-part>
    </si-split>
  </si-split-part>
</si-split>
```

### [SiSplitComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.component.ts#L56-L350>)

**Kind:** component

**Selector:** `si-split`

```
import { SiSplitComponent } from '@siemens/element-ng/split';
```

```
component SiSplitComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [gutterSize](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.component.ts#L62-L62>) | `number` | `16` | Size of the gutter (divider) between split parts in pixels. |
| [orientation](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.component.ts#L69-L69>) | `SplitOrientation` | `'horizontal'` | Defines the split layout direction. |
| [stateId](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.component.ts#L75-L75>) | `string \| undefined` |  | An optional stateId to uniquely identify a component instance. Required for persistence of ui state. |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [sizesChange](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.component.ts#L80-L80>) | `number[]` | Emits the sizes of all parts as percentages when the user resizes a gutter. |

### [SiSplitPartComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L38-L276>)

**Kind:** component

**Selector:** `si-split-part`

```
import { SiSplitPartComponent } from '@siemens/element-ng/split';
```

```
component SiSplitPartComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [actions](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L45-L45>) | `Action[]` | `[]` | Action buttons displayed in the split part header. |
| [collapseIconClass](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L58-L58>) | `string \| undefined` |  | Sets the icon class that is used in the buttons of split parts to collapse and uncollapse the parts. |
| [collapseLabel](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L108-L110>) | `TranslatableString` | `` $localize`:@@SI_SPLIT.COLLAPSE_LABEL:Collapse` `` | Aria label for collapse button. Needed for a11y |
| [collapseOthers](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L134-L134>) | `boolean` | `false` | This toggles the behavior when collapsing this split part. If enabled, all split parts between this one and the end of the split in the respective direction will be collapsed if this part is collapsed. If disabled, only this split part will be collapsed. |
| [collapseToMinSize](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L65-L65>) | `boolean` | `false` | Collapse only to the given min size. |
| [collapsible](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L52-L52>) | `CollapseTo \| undefined` | `undefined` | Defines whether and in which direction the split part can collapse. When unset, the collapse button is hidden. |
| [expanded](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L141-L141>) | `boolean` | `true` | Sets the initial expanded or collapsed state of the split part. |
| [headerTemplate](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L70-L70>) | `TemplateRef<{ $implicit: SiSplitPartComponent; }> \| undefined` |  | Custom template for the split part header. The template receives the component instance as implicit context. |
| [heading](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L75-L75>) | `TranslatableString \| undefined` |  | Sets the title of the split part header. |
| [minSize](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L82-L82>) | `number` | `0` | Minimum size in px. |
| [removeContentOnCollapse](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L92-L92>) | `boolean` | `false` | When a split part is collapsed, the content gets hidden but it will still remain within the DOM. If you want to remove and destroy the component in collapsed mode and recreate it on un-collapse, set this property to true. |
| [showHeader](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L99-L99>) | `boolean` | `true` | Defines if the header of the split part is visible. Default is true. |
| [size](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L120-L120>) (required) | `number` |  | Expanded size. |
| [stateId](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L115-L115>) | `string \| undefined` |  | An optional stateId to uniquely identify a component instance. Required for persistence of ui state. |
| [unit](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L125-L125>) (required) | `SplitUnit` |  | Unit for the configured [size](<index.html#SiSplitPartComponent.size>). |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [collapseChanged](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L146-L146>) | `boolean` | Emits when the part is collapsed or expanded. |
| [stateChange](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L150-L150>) | `PartState` | Emits the part's expanded state and size after it is toggled. |

#### Attributes and Methods

##### collapsed

[Source for collapsed](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L183-L185>)

**Modifiers:** readonly

**Type:** `boolean`

Get collapsed state.

Returns: True if the split part is collapsed, false is expanded.

##### toggleCollapse

[Source for toggleCollapse](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split-part.component.ts#L248-L257>)

Toggles the collapsed or expanded state.

```
toggleCollapse(): void
```

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

### Types Documentation

### [Action](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L10-L14>)

**Kind:** interface

```
import type { Action } from '@siemens/element-ng/split';
```

```
interface Action
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [click](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L13-L13>) | `(evt: Event) => void` |  |
| [iconClass](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L11-L11>) | `string` |  |
| [tooltip](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L12-L12>) | `string` |  |

### [CollapseTo](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L6-L6>)

**Kind:** type alias

```
import type { CollapseTo } from '@siemens/element-ng/split';
```

```
type CollapseTo = 'to-start' | 'to-end'
```

### [SplitOrientation](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L7-L7>)

**Kind:** type alias

```
import type { SplitOrientation } from '@siemens/element-ng/split';
```

```
type SplitOrientation = 'horizontal' | 'vertical'
```

### [SplitUnit](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L8-L8>)

**Kind:** type alias

```
import type { SplitUnit } from '@siemens/element-ng/split';
```

```
type SplitUnit = 'px' | 'fr'
```

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

Represents a translatable string. This can either be a translation key, e.g. `ACTIONS.EDIT` that will be automatically translated when displayed on the UI or a pre-translated string, e.g. `Edit`. Equivalent to a normal string in usage and functionality.

```
type TranslatableString = string & Translatable
```

### [PartState](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L16-L19>)

**Kind:** interface

```
import type { PartState } from '@siemens/element-ng/split';
```

```
interface PartState
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [expanded](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L17-L17>) (optional) | `boolean` |  |
| [size](<https://github.com/siemens/element/blob/main/projects/element-ng/split/si-split.interfaces.ts#L18-L18>) (optional) | `number` |  |
