Skip to content
Related Articles

Related Articles

Angular ngx Bootstrap Accordion Component

Improve Article
Save Article
  • Last Updated : 02 Sep, 2021
Improve Article
Save Article

Angular ngx bootstrap is a bootstrap framework used with angular to create components with great styling and this framework is very easy to use and is used to make responsive websites.

In this article, we will know how to use accordion in angular ngx bootstrap. The Accordion is used to display collapsible content that presents information in a limited amount of space.

Installation syntax:

npm install ngx-bootstrap --save 



  • First, install the angular ngx bootstrap using the above-mentioned command.

  • Add the following script in index.html

    <link href=”” rel=”stylesheet”>

  • Import accordion component in module.ts
  • In app.component.html make an accordion component.
  • Serve the app using ng serve.

Example 1:


<!doctype html>
<html lang="en">
    <meta charset="utf-8">
    <base href="/">
    <meta name="viewport" content=
        "width=device-width, initial-scale=1">
    <link href=
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <link rel="preconnect" href="">
    <link href=
<body class="mat-typography">


<accordion [isAnimated]="true">
    <accordion-group heading="Header1">
    <accordion-group heading="Header2">
    <accordion-group heading="Header3">
    <accordion-group heading="Header4">


import { NgModule } from '@angular/core';
// Importing forms module
import { FormsModule, ReactiveFormsModule }
    from '@angular/forms';
import { BrowserModule }
    from '@angular/platform-browser';
import { BrowserAnimationsModule }
    from '@angular/platform-browser/animations';
import { AccordionModule }
    from 'ngx-bootstrap/accordion';
import { AppComponent }
    from './app.component';
    bootstrap: [
    declarations: [
    imports: [
export class AppModule { }



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!