# Collapse

To use Card, first import `SharedModule` in your module.

```typescript
import {SharedModule} from '@gaxon/modules';

@NgModule({
  ...
  imports: [SharedModule, ...],
  ...
})
export class YourAppModule {
}
```

### Basic Collapse

{% tabs %}
{% tab title="Preview" %}
![](/files/-LuP47TU-Su6IVZc8g0D)
{% endtab %}

{% tab title="HTML" %}

```markup
<p>
  <button type="button" class="btn btn-outline-primary" [ngClass]="{active:!isCollapsed}" (click)="isCollapsed = !isCollapsed"
          [attr.aria-expanded]="!isCollapsed" aria-controls="collapseExample">
    {{(isCollapsed) ? 'Expand' : 'Collapse'}}
  </button>
</p>
<div id="collapseExample" [ngbCollapse]="isCollapsed">
  <div class="card">
    <div class="card-body">
      You can collapse this card by clicking Toggle
    </div>
  </div>
</div>
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Component} from '@angular/core';

@Component({
  selector: 'app-ngbd-collapse-basic',
  templateUrl: './collapse-basic.html'
})
export class NgbdCollapseBasic {
  public isCollapsed = false;
}

```

{% endtab %}
{% endtabs %}

### Multiple Target Collapse

{% tabs %}
{% tab title="Preview" %}
![](/files/-LuP4BlBUNEEYBqHqw7K)
{% endtab %}

{% tab title="HTML" %}

```markup
<p class="mb-0">
  <a class="btn btn-primary mr-2 mb-2" href="#multiCollapseExample1" (click)="collapsedWithAnchor($event)"
     role="button"
     [attr.aria-expanded]="!multiple.option1" aria-controls="multiCollapseExample1">First Element</a>

  <button class="btn btn-primary mr-2 mb-2" type="button" (click)="multiple.option2 = !multiple.option2"
          [attr.aria-expanded]="!multiple.option2" aria-controls="multiCollapseExample2">Second Element
  </button>

  <button class="btn btn-primary mr-2 mb-2" type="button" (click)="toggleCollapsed($event)"
          aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements
  </button>
</p>
<div class="row">
  <div class="col">
    <div class="multi-collapse" id="multiCollapseExample1" [ngbCollapse]="multiple.option1">
      <div class="card card-body mb-0">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.
        Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
      </div>
    </div>
  </div>
  <div class="col">
    <div class="multi-collapse" id="multiCollapseExample2" [ngbCollapse]="multiple.option2">
      <div class="card card-body mb-0">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid.
        Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.
      </div>
    </div>
  </div>
</div>
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
import {Component} from '@angular/core';

@Component({
  selector: 'app-ngbd-collapse-basic',
  templateUrl: './collapse-basic.html'
})
export class NgbdCollapseBasic {
  public multiple = {
    option1: true,
    option2: true
  };

  collapsedWithAnchor(event) {
    event.preventDefault();

    this.multiple.option1 = !this.multiple.option1;
  }

  toggleCollapsed(event) {
    event.preventDefault();

    this.multiple.option1 = !this.multiple.option1;
    this.multiple.option2 = !this.multiple.option2;
  }
}

```

{% endtab %}
{% endtabs %}

For more information about options, check the [Ng-Bootstrap](https://ng-bootstrap.github.io/#/components/collapse/examples)

### Accordion

{% tabs %}
{% tab title="Preview" %}
![](/files/-LuP6BrEc8VuzrRZJcu6)
{% endtab %}

{% tab title="Second Tab" %}

```markup
<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
  <ngb-panel title="Simple">
    <ng-template ngbPanelContent>
      Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
      aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
      sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
      craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
      occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
      labore sustainable VHS.
    </ng-template>
  </ngb-panel>
  <ngb-panel>
    <ng-template ngbPanelTitle>
      <span>&#9733; <b>Fancy</b> title &#9733;</span>
    </ng-template>
    <ng-template ngbPanelContent>
      Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
      aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
      sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
      craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
      occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
      labore sustainable VHS.
    </ng-template>
  </ngb-panel>
  <ngb-panel title="Disabled" [disabled]="true">
    <ng-template ngbPanelContent>
      Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
      aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
      sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
      craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings
      occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus
      labore sustainable VHS.
    </ng-template>
  </ngb-panel>
</ngb-accordion>

```

{% endtab %}
{% endtabs %}

For more information about options, check the [Ng-Bootstrap](https://ng-bootstrap.github.io/#/components/accordion/examples)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-drift-angular.g-axon.work/components/collapse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
