@angular-bootstrap/ngbootstrap 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @angular-bootstrap/ngbootstrap
|
|
2
2
|
|
|
3
|
-
Angular UI library providing
|
|
3
|
+
Angular UI library providing Datagrid, Drag‑and‑drop, Pagination, Stepper, Splitter, Tree, Typeahead, and Chips components with Bootstrap‑friendly styling.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -10,8 +10,9 @@ Angular UI library providing datagrid, drag‑and‑drop, pagination, and steppe
|
|
|
10
10
|
- Stepper – horizontal/vertical stepper with custom labels, error states, theming hooks, and keyboard support.
|
|
11
11
|
- Splitter – resizable horizontal/vertical panes with collapsing, keyboard resizing, and ARIA semantics.
|
|
12
12
|
- Tree – keyboard-accessible tree with optional checkboxes, JSON-style expanders, and expand/collapse helpers.
|
|
13
|
-
- Typeahead –
|
|
14
|
-
-
|
|
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.
|
|
15
16
|
|
|
16
17
|
## Installation
|
|
17
18
|
|
|
@@ -21,11 +22,12 @@ npm install @angular-bootstrap/ngbootstrap
|
|
|
21
22
|
|
|
22
23
|
Make sure your app:
|
|
23
24
|
|
|
24
|
-
- Uses Angular
|
|
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):
|
|
26
27
|
|
|
27
28
|
```css
|
|
28
29
|
@import 'bootstrap/dist/css/bootstrap.min.css';
|
|
30
|
+
@import 'bootstrap-icons/font/bootstrap-icons.css';
|
|
29
31
|
```
|
|
30
32
|
|
|
31
33
|
## Usage overview
|
|
@@ -130,34 +132,6 @@ import { Component } from '@angular/core';
|
|
|
130
132
|
import { NgbStepperComponent } from '@angular-bootstrap/ngbootstrap/stepper';
|
|
131
133
|
import { NgbStepperStep } from '@angular-bootstrap/ngbootstrap/stepper';
|
|
132
134
|
|
|
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
|
-
|
|
161
135
|
@Component({
|
|
162
136
|
standalone: true,
|
|
163
137
|
selector: 'app-wizard',
|
|
@@ -205,11 +179,29 @@ Stepper highlights:
|
|
|
205
179
|
- Controlled navigation (`allowRevisit`, `next()`, `prev()`, `reset()` and events).
|
|
206
180
|
- Theming hooks via `theme` and CSS classes (`bootstrap`, `material`, `tailwind`).
|
|
207
181
|
|
|
208
|
-
###
|
|
182
|
+
### Splitter
|
|
209
183
|
|
|
210
184
|
```ts
|
|
211
185
|
import { Component } from '@angular/core';
|
|
212
|
-
import {
|
|
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
|
+
```
|
|
213
205
|
|
|
214
206
|
### Tree
|
|
215
207
|
|
|
@@ -222,35 +214,73 @@ import { NgbTreeComponent, NgbTreeNode } from '@angular-bootstrap/ngbootstrap/tr
|
|
|
222
214
|
selector: 'app-tree',
|
|
223
215
|
imports: [NgbTreeComponent],
|
|
224
216
|
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>
|
|
233
218
|
`,
|
|
234
219
|
})
|
|
235
220
|
export class TreeExampleComponent {
|
|
236
221
|
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' }] },
|
|
246
223
|
];
|
|
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';
|
|
247
233
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
+
];
|
|
251
249
|
}
|
|
252
250
|
```
|
|
253
251
|
|
|
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
|
+
|
|
254
284
|
@Component({
|
|
255
285
|
standalone: true,
|
|
256
286
|
selector: 'app-drag-list',
|