11# @angular-bootstrap/ngbootstrap
22
3- Angular UI library providing datagrid, drag ‑and‑drop, pagination, and stepper components with Bootstrap‑friendly styling.
3+ Angular UI library providing Datagrid, Drag ‑and‑drop, Pagination, Stepper, Splitter, Tree, Typeahead, and Chips components with Bootstrap‑friendly styling.
44
55## Features
66
@@ -10,8 +10,9 @@ Angular UI library providing datagrid, drag‑and‑drop, pagination, and steppe
1010- Stepper – horizontal/vertical stepper with custom labels, error states, theming hooks, and keyboard support.
1111- Splitter – resizable horizontal/vertical panes with collapsing, keyboard resizing, and ARIA semantics.
1212- Tree – keyboard-accessible tree with optional checkboxes, JSON-style expanders, and expand/collapse helpers.
13- - Typeahead – virtualized, debounced search with single/multi select, exact-match selection, and scroll hooks.
14- - Angular + Bootstrap first – built for modern Angular (v17–20) and works with plain Bootstrap CSS; Material/Tailwind can be layered via custom styles.
13+ - Typeahead – Bootstrap dropdown overlay with debouncing, virtualization, single/multi select, chips/tags mode, custom templates, and Reactive Forms support.
14+ - Chips – small reusable chips/tags component used by Typeahead (can also be used standalone).
15+ - Angular + Bootstrap first – built for modern Angular (v21) and works with plain Bootstrap CSS; Material/Tailwind can be layered via custom styles.
1516
1617## Installation
1718
@@ -21,11 +22,12 @@ npm install @angular-bootstrap/ngbootstrap
2122
2223Make sure your app:
2324
24- - Uses Angular 17–20 .
25- - Includes Bootstrap CSS (for example in ` angular.json ` or global styles):
25+ - Uses Angular 21 (peer deps: ` >=21 <22 ` ) .
26+ - Includes Bootstrap CSS + Bootstrap Icons (for example in ` angular.json ` or global styles):
2627
2728``` css
2829@import ' bootstrap/dist/css/bootstrap.min.css' ;
30+ @import ' bootstrap-icons/font/bootstrap-icons.css' ;
2931```
3032
3133## Usage overview
@@ -130,34 +132,6 @@ import { Component } from '@angular/core';
130132import { NgbStepperComponent } from ' @angular-bootstrap/ngbootstrap/stepper' ;
131133import { NgbStepperStep } from ' @angular-bootstrap/ngbootstrap/stepper' ;
132134
133- ### Splitter
134-
135- ` ` ` ts
136- import { Component } from '@angular/core';
137- import { NgbSplitterComponent, NgbSplitterPaneComponent } from '@angular-bootstrap/ngbootstrap/splitter';
138-
139- @Component({
140- standalone: true,
141- selector: 'app-splitter',
142- imports: [NgbSplitterComponent, NgbSplitterPaneComponent],
143- template: `
144- < ngb - splitter orientation = " horizontal" >
145- < ngb - splitter - pane size = " 30%" min = " 200px" [collapsible ]= " true" (collapsedChange )= " onCollapse($event)" >
146- < div class = " p-3" > Navigation < / div >
147- < / ngb - splitter - pane >
148- < ngb - splitter - pane >
149- < div class = " p-3" > Main content < / div >
150- < / ngb - splitter - pane >
151- < / ngb - splitter >
152- ` ,
153- })
154- export class SplitterExampleComponent {
155- onCollapse(collapsed: boolean) {
156- // persist pane state if needed
157- }
158- }
159- ` ` `
160-
161135@Component ({
162136 standalone: true ,
163137 selector: ' app-wizard' ,
@@ -205,11 +179,29 @@ Stepper highlights:
205179- Controlled navigation (` allowRevisit ` , ` next() ` , ` prev() ` , ` reset() ` and events).
206180- Theming hooks via ` theme ` and CSS classes (` bootstrap ` , ` material ` , ` tailwind ` ).
207181
208- ### Drag & drop
182+ ### Splitter
209183
210184``` ts
211185import { Component } from ' @angular/core' ;
212- import { DndListDirective , DndItemDirective } from ' @angular-bootstrap/ngbootstrap/drag-drop' ;
186+ import { NgbSplitterComponent , NgbSplitterPaneComponent } from ' @angular-bootstrap/ngbootstrap/splitter' ;
187+
188+ @Component ({
189+ standalone: true ,
190+ selector: ' app-splitter' ,
191+ imports: [NgbSplitterComponent , NgbSplitterPaneComponent ],
192+ template: `
193+ <ngb-splitter orientation="horizontal" [handleThickness]="10">
194+ <ngb-splitter-pane size="25%" collapsible>
195+ <div class="p-3">Navigation</div>
196+ </ngb-splitter-pane>
197+ <ngb-splitter-pane>
198+ <div class="p-3">Main content</div>
199+ </ngb-splitter-pane>
200+ </ngb-splitter>
201+ ` ,
202+ })
203+ export class SplitterExampleComponent {}
204+ ```
213205
214206### Tree
215207
@@ -222,35 +214,73 @@ import { NgbTreeComponent, NgbTreeNode } from '@angular-bootstrap/ngbootstrap/tr
222214 selector: ' app-tree' ,
223215 imports: [NgbTreeComponent ],
224216 template: `
225- < ngb - tree
226- [nodes ]= " nodes"
227- [showCheckbox ]= " true"
228- type = " json"
229- (expand )= " onExpand($event)"
230- (collapse )= " onCollapse($event)"
231- (selectionChange )= " onSelection($event)"
232- > </ngb -tree >
217+ <ngb-tree [nodes]="nodes" type="default"></ngb-tree>
233218 ` ,
234219})
235220export class TreeExampleComponent {
236221 nodes: NgbTreeNode [] = [
237- {
238- id: 'parent',
239- label: 'Parent',
240- expanded: true,
241- children: [
242- { id: 'child-1', label: 'Child 1' },
243- { id: 'child-2', label: 'Child 2' },
244- ],
245- },
222+ { id: ' a' , label: ' Parent' , expanded: true , children: [{ id: ' a-1' , label: ' Child 1' }] },
246223 ];
224+ }
225+ ```
226+
227+ ### Typeahead
228+
229+ ``` ts
230+ import { Component } from ' @angular/core' ;
231+ import { FormControl , ReactiveFormsModule } from ' @angular/forms' ;
232+ import { NgbTypeaheadComponent , NgbTypeaheadItem } from ' @angular-bootstrap/ngbootstrap/typeahead' ;
247233
248- onExpand(node: NgbTreeNode) {}
249- onCollapse(node: NgbTreeNode) {}
250- onSelection(selected: NgbTreeNode[]) {}
234+ @Component ({
235+ standalone: true ,
236+ selector: ' app-typeahead' ,
237+ imports: [ReactiveFormsModule , NgbTypeaheadComponent ],
238+ template: `
239+ <ngb-typeahead [data]="countries" [showDropdownButton]="true" [multiSelect]="true" [chips]="true"></ngb-typeahead>
240+ <ngb-typeahead [data]="countries" [showDropdownButton]="true" [formControl]="country"></ngb-typeahead>
241+ ` ,
242+ })
243+ export class TypeaheadExampleComponent {
244+ country = new FormControl <string | null >(' IN' );
245+ countries: NgbTypeaheadItem [] = [
246+ { id: ' IN' , label: ' India' , value: ' IN' },
247+ { id: ' US' , label: ' United States' , value: ' US' },
248+ ];
251249}
252250```
253251
252+ ### Chips
253+
254+ ``` ts
255+ import { Component } from ' @angular/core' ;
256+ import { NgbChipsComponent } from ' @angular-bootstrap/ngbootstrap/chips' ;
257+
258+ @Component ({
259+ standalone: true ,
260+ selector: ' app-chips' ,
261+ imports: [NgbChipsComponent ],
262+ template: `
263+ <ngb-chips [items]="items" (remove)="onRemove($event)"></ngb-chips>
264+ ` ,
265+ })
266+ export class ChipsExampleComponent {
267+ items = [
268+ { id: 1 , label: ' One' },
269+ { id: 2 , label: ' Two' },
270+ ];
271+
272+ onRemove(item : { id: number ; label: string }) {
273+ this .items = this .items .filter ((x ) => x .id !== item .id );
274+ }
275+ }
276+ ```
277+
278+ ### Drag & drop
279+
280+ ``` ts
281+ import { Component } from ' @angular/core' ;
282+ import { DndListDirective , DndItemDirective } from ' @angular-bootstrap/ngbootstrap/drag-drop' ;
283+
254284@Component ({
255285 standalone: true ,
256286 selector: ' app-drag-list' ,
0 commit comments