@@ -4,7 +4,7 @@ Angular UI library providing Datagrid, Drag‑and‑drop, Pagination, Stepper, S
44
55## Features
66
7- - Datagrid – sortable, filterable, paginated, editable table with export (PDF/Excel) support and accessible templates.
7+ - Datagrid – sortable, filterable, paginated, Sticky Header/Footer, Sticky Rows, Grid Styling, editable table with export (PDF/Excel) support and accessible templates.
88- Drag & drop – lightweight list and item directives with keyboard‑friendly a11y helpers.
99- Pagination – standalone Bootstrap‑styled pagination component.
1010- Stepper – horizontal/vertical stepper with custom labels, error states, theming hooks, and keyboard support.
@@ -34,57 +34,6 @@ Make sure your app:
3434
3535All components are standalone, so you import them directly into your feature components.
3636
37- ### Datagrid
38-
39- ``` ts
40- import { Component } from ' @angular/core' ;
41- import { Datagrid } from ' @angular-bootstrap/ngbootstrap/datagrid' ;
42- import { NgbDatagridDefaultEditService } from ' @angular-bootstrap/ngbootstrap/datagrid' ;
43-
44- interface User {
45- id: number ;
46- name: string ;
47- email: string ;
48- }
49-
50- @Component ({
51- standalone: true ,
52- selector: ' app-users' ,
53- imports: [Datagrid ],
54- template: `
55- <ngb-datagrid
56- [columns]="columns"
57- [data]="rows"
58- [trackBy]="trackById"
59- [editService]="editService"
60- [enableSorting]="true"
61- [enableFiltering]="true"
62- [enablePagination]="true"
63- [pageSize]="10"
64- (rowSave)="onRowSave($event)"
65- ></ngb-datagrid>
66- ` ,
67- })
68- export class UsersComponent {
69- trackById = (_ : number , row : User ) => row .id ;
70- editService = new NgbDatagridDefaultEditService <User >();
71- columns = [
72- { field: ' id' , header: ' ID' , sortable: true },
73- { field: ' name' , header: ' Name' , sortable: true , filterable: true },
74- { field: ' email' , header: ' Email' , sortable: true , filterable: true , type: ' email' },
75- ];
76-
77- rows: User [] = [
78- { id: 1 , name: ' Alice' , email: ' alice@example.com' },
79- { id: 2 , name: ' Bob' , email: ' bob@example.com' },
80- ];
81-
82- onRowSave(evt : { original: User ; updated: User }) {
83- // persist the update
84- }
85- }
86- ```
87-
8837Key datagrid capabilities:
8938
9039- Sorting (` enableSorting ` , ` sortChange ` ).
@@ -101,82 +50,6 @@ Export requires optional peer dependencies. Install only if you use export:
10150npm install jspdf jspdf-autotable xlsx
10251```
10352
104- ### Pagination
105-
106- ``` ts
107- import { Component } from ' @angular/core' ;
108- import { NgbPaginationComponent } from ' @angular-bootstrap/ngbootstrap/pagination' ;
109-
110- @Component ({
111- standalone: true ,
112- selector: ' app-pager' ,
113- imports: [NgbPaginationComponent ],
114- template: `
115- <ngb-pagination
116- [(page)]="page"
117- [pageSize]="pageSize"
118- [collectionSize]="total"
119- (pageChange)="loadPage($event)"
120- ></ngb-pagination>
121- ` ,
122- })
123- export class PagerComponent {
124- page = 1 ;
125- pageSize = 10 ;
126- total = 250 ;
127-
128- loadPage(p : number ) {
129- this .page = p ;
130- // fetch data for the page
131- }
132- }
133- ```
134-
135- ### Stepper
136-
137- ``` ts
138- import { Component } from ' @angular/core' ;
139- import { NgbStepperComponent } from ' @angular-bootstrap/ngbootstrap/stepper' ;
140- import { NgbStepperStep } from ' @angular-bootstrap/ngbootstrap/stepper' ;
141-
142- @Component ({
143- standalone: true ,
144- selector: ' app-wizard' ,
145- imports: [NgbStepperComponent ],
146- template: `
147- <ngb-stepper
148- [steps]="steps"
149- [(selectedIndex)]="index"
150- orientation="horizontal"
151- [allowRevisit]="false"
152- theme="bootstrap"
153- (selectionChange)="onSelectionChange($event)"
154- >
155- <ng-template #stepContent let-index="index">
156- <ng-container [ngSwitch]="index">
157- <div *ngSwitchCase="0">Account step</div>
158- <div *ngSwitchCase="1">Profile step</div>
159- <div *ngSwitchCase="2">Confirm step</div>
160- </ng-container>
161- </ng-template>
162- </ngb-stepper>
163- ` ,
164- })
165- export class WizardComponent {
166- index = 0 ;
167-
168- steps: NgbStepperStep [] = [
169- { id: ' account' , label: ' Account' },
170- { id: ' profile' , label: ' Profile' },
171- { id: ' confirm' , label: ' Confirm' , optional: true },
172- ];
173-
174- onSelectionChange(e : { previousIndex: number ; currentIndex: number }) {
175- // analytics, autosave, etc.
176- }
177- }
178- ```
179-
18053Stepper highlights:
18154
18255- Horizontal/vertical variants via ` orientation ` .
@@ -186,125 +59,6 @@ Stepper highlights:
18659- Controlled navigation (` allowRevisit ` , ` next() ` , ` prev() ` , ` reset() ` and events).
18760- Theming hooks via ` theme ` and CSS classes (` bootstrap ` , ` material ` , ` tailwind ` ).
18861
189- ### Splitter
190-
191- ``` ts
192- import { Component } from ' @angular/core' ;
193- import { NgbSplitterComponent , NgbSplitterPaneComponent } from ' @angular-bootstrap/ngbootstrap/splitter' ;
194-
195- @Component ({
196- standalone: true ,
197- selector: ' app-splitter' ,
198- imports: [NgbSplitterComponent , NgbSplitterPaneComponent ],
199- template: `
200- <ngb-splitter orientation="horizontal" [handleThickness]="10">
201- <ngb-splitter-pane size="25%" collapsible>
202- <div class="p-3">Navigation</div>
203- </ngb-splitter-pane>
204- <ngb-splitter-pane>
205- <div class="p-3">Main content</div>
206- </ngb-splitter-pane>
207- </ngb-splitter>
208- ` ,
209- })
210- export class SplitterExampleComponent {}
211- ```
212-
213- ### Tree
214-
215- ``` ts
216- import { Component } from ' @angular/core' ;
217- import { NgbTreeComponent , NgbTreeNode } from ' @angular-bootstrap/ngbootstrap/tree' ;
218-
219- @Component ({
220- standalone: true ,
221- selector: ' app-tree' ,
222- imports: [NgbTreeComponent ],
223- template: `
224- <ngb-tree [nodes]="nodes" type="default"></ngb-tree>
225- ` ,
226- })
227- export class TreeExampleComponent {
228- nodes: NgbTreeNode [] = [
229- { id: ' a' , label: ' Parent' , expanded: true , children: [{ id: ' a-1' , label: ' Child 1' }] },
230- ];
231- }
232- ```
233-
234- ### Typeahead
235-
236- ``` ts
237- import { Component } from ' @angular/core' ;
238- import { FormControl , ReactiveFormsModule } from ' @angular/forms' ;
239- import { NgbTypeaheadComponent , NgbTypeaheadItem } from ' @angular-bootstrap/ngbootstrap/typeahead' ;
240-
241- @Component ({
242- standalone: true ,
243- selector: ' app-typeahead' ,
244- imports: [ReactiveFormsModule , NgbTypeaheadComponent ],
245- template: `
246- <ngb-typeahead [data]="countries" [showDropdownButton]="true" [multiSelect]="true" [chips]="true"></ngb-typeahead>
247- <ngb-typeahead [data]="countries" [showDropdownButton]="true" [formControl]="country"></ngb-typeahead>
248- ` ,
249- })
250- export class TypeaheadExampleComponent {
251- country = new FormControl <string | null >(' IN' );
252- countries: NgbTypeaheadItem [] = [
253- { id: ' IN' , label: ' India' , value: ' IN' },
254- { id: ' US' , label: ' United States' , value: ' US' },
255- ];
256- }
257- ```
258-
259- ### Chips
260-
261- ``` ts
262- import { Component } from ' @angular/core' ;
263- import { NgbChipsComponent } from ' @angular-bootstrap/ngbootstrap/chips' ;
264-
265- @Component ({
266- standalone: true ,
267- selector: ' app-chips' ,
268- imports: [NgbChipsComponent ],
269- template: `
270- <ngb-chips [items]="items" (remove)="onRemove($event)"></ngb-chips>
271- ` ,
272- })
273- export class ChipsExampleComponent {
274- items = [
275- { id: 1 , label: ' One' },
276- { id: 2 , label: ' Two' },
277- ];
278-
279- onRemove(item : { id: number ; label: string }) {
280- this .items = this .items .filter ((x ) => x .id !== item .id );
281- }
282- }
283- ```
284-
285- ### Drag & drop
286-
287- ``` ts
288- import { Component } from ' @angular/core' ;
289- import { DndListDirective , DndItemDirective } from ' @angular-bootstrap/ngbootstrap/drag-drop' ;
290-
291- @Component ({
292- standalone: true ,
293- selector: ' app-drag-list' ,
294- imports: [DndListDirective , DndItemDirective ],
295- template: `
296- <ul dndList [dndListData]="items">
297- <li *ngFor="let item of items" dndItem [dndItemData]="item">
298- {{ item }}
299- </li>
300- </ul>
301- ` ,
302- })
303- export class DragListComponent {
304- items = [' One' , ' Two' , ' Three' ];
305- }
306- ```
307-
30862Refer to the source under ` src/drag-drop ` and ` src/datagrid ` /` src/stepper ` for full API details until a dedicated docs site is added.
30963
31064## Development
0 commit comments