Drift Angular
Search…
Collapse
To use Card, first import SharedModule in your module.
1
import {SharedModule} from '@gaxon/modules';
2
3
@NgModule({
4
...
5
imports: [SharedModule, ...],
6
...
7
})
8
export class YourAppModule {
9
}
Copied!

Basic Collapse

Preview
HTML
TypeScript
1
<p>
2
<button type="button" class="btn btn-outline-primary" [ngClass]="{active:!isCollapsed}" (click)="isCollapsed = !isCollapsed"
3
[attr.aria-expanded]="!isCollapsed" aria-controls="collapseExample">
4
{{(isCollapsed) ? 'Expand' : 'Collapse'}}
5
</button>
6
</p>
7
<div id="collapseExample" [ngbCollapse]="isCollapsed">
8
<div class="card">
9
<div class="card-body">
10
You can collapse this card by clicking Toggle
11
</div>
12
</div>
13
</div>
Copied!
1
import {Component} from '@angular/core';
2
3
@Component({
4
selector: 'app-ngbd-collapse-basic',
5
templateUrl: './collapse-basic.html'
6
})
7
export class NgbdCollapseBasic {
8
public isCollapsed = false;
9
}
10
Copied!

Multiple Target Collapse

Preview
HTML
TypeScript
1
<p class="mb-0">
2
<a class="btn btn-primary mr-2 mb-2" href="#multiCollapseExample1" (click)="collapsedWithAnchor($event)"
3
role="button"
4
[attr.aria-expanded]="!multiple.option1" aria-controls="multiCollapseExample1">First Element</a>
5
6
<button class="btn btn-primary mr-2 mb-2" type="button" (click)="multiple.option2 = !multiple.option2"
7
[attr.aria-expanded]="!multiple.option2" aria-controls="multiCollapseExample2">Second Element
8
</button>
9
10
<button class="btn btn-primary mr-2 mb-2" type="button" (click)="toggleCollapsed($event)"
11
aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements
12
</button>
13
</p>
14
<div class="row">
15
<div class="col">
16
<div class="multi-collapse" id="multiCollapseExample1" [ngbCollapse]="multiple.option1">
17
<div class="card card-body mb-0">
18
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.
19
Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
20
</div>
21
</div>
22
</div>
23
<div class="col">
24
<div class="multi-collapse" id="multiCollapseExample2" [ngbCollapse]="multiple.option2">
25
<div class="card card-body mb-0">
26
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.
27
Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
28
</div>
29
</div>
30
</div>
31
</div>
Copied!
1
import {Component} from '@angular/core';
2
3
@Component({
4
selector: 'app-ngbd-collapse-basic',
5
templateUrl: './collapse-basic.html'
6
})
7
export class NgbdCollapseBasic {
8
public multiple = {
9
option1: true,
10
option2: true
11
};
12
13
collapsedWithAnchor(event) {
14
event.preventDefault();
15
16
this.multiple.option1 = !this.multiple.option1;
17
}
18
19
toggleCollapsed(event) {
20
event.preventDefault();
21
22
this.multiple.option1 = !this.multiple.option1;
23
this.multiple.option2 = !this.multiple.option2;
24
}
25
}
26
Copied!
For more information about options, check the Ng-Bootstrap

Accordion

Preview
Second Tab
1
<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
2
<ngb-panel title="Simple">
3
<ng-template ngbPanelContent>
4
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
5
aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
6
sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
7
craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
8
occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
9
labore sustainable VHS.
10
</ng-template>
11
</ngb-panel>
12
<ngb-panel>
13
<ng-template ngbPanelTitle>
14
<span>&#9733; <b>Fancy</b> title &#9733;</span>
15
</ng-template>
16
<ng-template ngbPanelContent>
17
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
18
aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
19
sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
20
craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
21
occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
22
labore sustainable VHS.
23
</ng-template>
24
</ngb-panel>
25
<ngb-panel title="Disabled" [disabled]="true">
26
<ng-template ngbPanelContent>
27
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
28
aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
29
sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
30
craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
31
occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
32
labore sustainable VHS.
33
</ng-template>
34
</ngb-panel>
35
</ngb-accordion>
36
Copied!
For more information about options, check the Ng-Bootstrap
Last modified 2yr ago