Angular Splitter Component Overview
The Ignite UI for Angular Splitter component provides the ability to create layouts, split into multiple vertically or horizontally arranged panes that may be resized, expanded and collapsed. These interactions are performed through UI exposed in the splitter bars between the panes. A simple Splitter layout is demonstrated in the demo below.
Angular Splitter Example
Getting Started with Ignite UI for Angular Splitter
To get started with the Ignite UI for Angular Splitter component, first you need to install Ignite UI for Angular. In an existing Angular application, type the following command:
ng add igniteui-angular
For a complete introduction to the Ignite UI for Angular, read the getting started topic.
The next step is to import the IgxSplitterModule in your app.module.ts file.
// app.module.ts
...
import { IgxSplitterModule } from 'igniteui-angular';
// import { IgxSplitterModule } from '@infragistics/igniteui-angular'; for licensed package
@NgModule({
...
imports: [..., IgxSplitterModule],
...
})
export class AppModule {}
Alternatively, as of 16.0.0 you can import the IgxSplitterComponent as a standalone dependency, or use the IGX_SPLITTER_DIRECTIVES token to import the component and all of its supporting components and directives.
// home.component.ts
import { IGX_SPLITTER_DIRECTIVES } from 'igniteui-angular';
// import { IGX_SPLITTER_DIRECTIVES } from '@infragistics/igniteui-angular'; for licensed package
@Component({
selector: 'app-home',
template: `
<igx-splitter>
<igx-splitter-pane>
Pane 1
</igx-splitter-pane>
<igx-splitter-pane>
Pane 2
</igx-splitter-pane>
</igx-splitter>
`,
styleUrls: ['home.component.scss'],
standalone: true,
imports: [IGX_SPLITTER_DIRECTIVES]
/* or imports: [IgxSplitterComponent, IgxSplitterPaneComponent] */
})
export class HomeComponent {}
Now that you have the Ignite UI for Angular Splitter module or directives imported, you can start using the igx-splitter component.
Using the Angular Splitter
igxSplitter is initialized with the igx-splitter tag. Multiple splitter panes can be defined under a single igx-splitter component. The content of the pane is templatable and will be rendered in its own resizable container.
<!-- splitter.component.html -->
<igx-splitter>
<igx-splitter-pane>
...
</igx-splitter-pane>
<igx-splitter-pane>
...
</igx-splitter-pane>
<igx-splitter-pane>
...
</igx-splitter-pane>
</igx-splitter>
Orientation
The splitter can be vertical or horizontal, which is defined by the type input. The default value is Vertical.
public type = SplitterType.Horizontal;
<igx-splitter [type]="type">
<igx-splitter-pane>
...
</igx-splitter-pane>
<igx-splitter-pane>
...
</igx-splitter-pane>
</igx-splitter>
Collapsible Splitter
You can make the splitter collapsible or not by showing or hiding the splitter's handle and expanders, using the nonCollapsible input. The default value is false, so the splitter is collapsible.
<igx-splitter [nonCollapsible]="true">
<igx-splitter-pane>
...
</igx-splitter-pane>
<igx-splitter-pane>
...
</igx-splitter-pane>
</igx-splitter>
Configuring panes
The igxSplitterPane component contains several input properties. You can set the initial pane size by using the size input property. The minSize and maxSize input properties can be used to set the minimum or maximum allowed size of the pane. Resizing beyond minSize and maxSize is not allowed.
<igx-splitter>
<igx-splitter-pane size='300px' minSize='100px'>
...
</igx-splitter-pane>
<igx-splitter-pane size='300px' maxSize='500px'>
...
</igx-splitter-pane>
</igx-splitter>
You can also forbid the resizing of a pane by setting its resizable input property to false.
<igx-splitter>
<igx-splitter-pane [resizable]='false'>
...
</igx-splitter-pane>
<igx-splitter-pane>
...
</igx-splitter-pane>
</igx-splitter>
Nested panes
You can nest splitter components to create a more complex layout inside a splitter pane.
public typeHorizontal = SplitterType.Horizontal;
public typeVertical = SplitterType.Vertical;
<igx-splitter style='height: 30vh;' [type]='typeHorizontal' >
<igx-splitter-pane>
<igx-splitter [type]='typeVertical' [style.width]='"100%"'>
<igx-splitter-pane>
Pane1.1
</igx-splitter-pane>
<igx-splitter-pane>
Pane1.2
</igx-splitter-pane>
</igx-splitter>
</igx-splitter-pane>
<igx-splitter-pane>
<igx-splitter [type]='typeVertical' [style.width]='"100%"'>
<igx-splitter-pane>
Pane2.1
</igx-splitter-pane>
<igx-splitter-pane>
Pane2.2
</igx-splitter-pane>
</igx-splitter>
</igx-splitter-pane>
</igx-splitter>
Demo
Keyboard navigation
Keyboard navigation is available by default in the splitter component. When you focus a splitter bar and press one of the following key combinations, the described behavior is performed.
Key combinations
Arrow Up- Moves the splitter bar up in a vertical splitterArrow Down- Moves the splitter bar down in a vertical splitterArrow Left- Moves the splitter bar left in a horizontal splitterArrow Right- Moves the splitter bar right in a horizontal splitterCtrl + Arrow Up- Expands/Collapses a pane in a vertical splitterCtrl + Arrow Down- Expands/Collapses a pane in a vertical splitterCtrl + Arrow Left- Expands/Collapses a pane in a horizontal splitterCtrl + Arrow Right- Expands/Collapses a pane in a horizontal splitter
Styling
Splitter Theme Property Map
When you modify a primary property, all related dependent properties are automatically updated to reflect the change:
| Primary Property | Dependent Property | Description |
|---|---|---|
| $bar-color | $handle-color | The color for the bar drag handle |
| $expander-color | The color for the arrow expander | |
| $focus-color | The color used for focused splitter bar |
To get started with styling the igxSplitter component, you need to import the index file, where all the theme functions and component mixins live:
@use "igniteui-angular/theming" as *;
// IMPORTANT: Prior to Ignite UI for Angular version 13 use:
// @import '~igniteui-angular/lib/core/styles/themes/index';
You can change the default styles of the splitter by creating a new theme that extends the splitter-theme. By providing just the base parameters, the theme will automatically generate all necessary styles for the interaction states.
// In splitter-styling-sample.component.scss
$splitter-theme: splitter-theme(
$bar-color: #011627,
$handle-color: #ecaa53,
$expander-color: #ecaa53,
$size: 4px
);
Using CSS Variables
The next step is to pass the custom splitter theme:
@include css-vars($custom-splitter-theme);
Demo
This is the final result from applying your new theme.
Styling with Tailwind
You can style the splitter using our custom Tailwind utility classes. Make sure to set up Tailwind first.
Along with the tailwind import in your global stylesheet, you can apply the desired theme utilities as follows:
@import "tailwindcss";
...
@use 'igniteui-theming/tailwind/utilities/material.css';
The utility file includes both light and dark theme variants.
- Use
light-*classes for the light theme. - Use
dark-*classes for the dark theme. - Append the component name after the prefix, e.g.,
light-splitter,dark-splitter.
Once applied, these classes enable dynamic theme calculations. From there, you can override the generated CSS variables using arbitrary properties. After the colon, provide any valid CSS color format (HEX, CSS variable, RGB, etc.).
You can find the full list of properties in the splitter-theme. The syntax is as follows:
<igx-splitter
class="!light-splitter ![--bar-color:#7B9E89]">
...
</igx-splitter>
Note
The exclamation mark(!) is required to ensure the utility class takes precedence. Tailwind applies styles in layers, and without marking these styles as important, they will get overridden by the component’s default theme.
Custom sizing
You can either use the --size variable, targeting the igx-splitter directly:
igx-splitter {
--size: 10px;
}
Or you can use the universal --igx-splitter-size variable to target all instances:
<div class="my-app">
<igx-splitter></igx-splitter>
</div>
.my-app {
--igx-splitter-size: 10px;
}
API References
Theming Dependencies
Our community is active and always welcoming to new ideas.