Component · v2.6.0
NgbSplitterComponent
Resizable horizontal or vertical layout containing projected ngb-splitter-pane components.
Import
import { NgbSplitterComponent } from '@angular-bootstrap/ngbootstrap';Selector:ngb-splitter
Usage notes
- Import NgbSplitterComponent and NgbSplitterPaneComponent. Project one ngb-splitter-pane per pane; an empty size shares available space.
- Splitter itself has no output events in the installed release. Listen to collapsedChange on each pane for collapse state. There is no resizeEnd or sizeChange output.
- Resizing uses pane min/max constraints. Browser measurements run after rendering; provide a usable height for vertical layouts.
Declaration
class NgbSplitterComponentInputs
orientation
Horizontal arranges panes left-to-right; vertical arranges them top-to-bottom.
orientation: 'horizontal' | 'vertical'Default:'horizontal'
handleThickness
Resize-handle thickness in pixels.
handleThickness: numberDefault:12
handleIconColor
CSS color of collapse/expand handle icons.
handleIconColor: stringDefault:'var(--ngb-on-surface, #000)'
verticalMinHeight
Minimum container height used for a vertical splitter.
verticalMinHeight: stringDefault:'280px'
resizable
Enables pointer resizing and keyboard resize actions on separators.
resizable: booleanDefault:true
barColor
CSS background color of separator bars.
barColor: stringDefault:'var(--ngb-border-color, #ccc)'
lineColor
CSS color of separator grip lines.
lineColor: stringDefault:'var(--ngb-on-surface, #000)'
Properties
panes
Content query of projected pane components, in display order.
panes: QueryList<NgbSplitterPaneComponent>Methods
onMouseMove
Document mousemove handler that updates a drag resize while active.
onMouseMove(event: MouseEvent): voidonMouseUp
Document mouseup handler that ends resizing.
onMouseUp(): voidonMouseDown
View handler that starts resizing at the given separator index.
onMouseDown(event: MouseEvent, index: number): voidonHandleToggle
View click handler that stops the event and toggles the associated pane.
onHandleToggle(event: Event, index: number): voidgetCollapseIcon
Returns the pane-toggle icon class based on orientation and collapsed state.
getCollapseIcon(pane: NgbSplitterPaneComponent): stringgetPaneFlex
Returns the flex sizing expression for a pane, including collapsed and automatic sizing.
getPaneFlex(pane: NgbSplitterPaneComponent): stringtogglePane
Toggles collapsed on the pane at a valid zero-based index and emits that pane’s collapsedChange. The method does not check collapsible.
togglePane(index: number): voidgetSeparatorAriaOrientation
Returns the separator orientation, perpendicular to the pane arrangement.
getSeparatorAriaOrientation(): 'horizontal' | 'vertical'getHandleValueNow
Returns the current pane size as an accessible percentage, when measurable.
getHandleValueNow(index: number): number | nullgetHandleValueMin
Returns the minimum accessible percentage for a resize handle, when measurable.
getHandleValueMin(index: number): number | nullgetHandleValueMax
Returns the maximum accessible percentage for a resize handle, when measurable.
getHandleValueMax(index: number): number | nullonHandleKeyDown
View keyboard handler for resizing and pane collapse/expand.
onHandleKeyDown(event: KeyboardEvent, index: number): void