Angular MDBootstrap Panels Component
MDBootstrap is a Material Design and bootstrap-based Angular UI library that is used to make attractive webpages with its seamless and easy-to-use component. In this article, we will know how to use Panels Component in Angular MDBootstap.
The Panels Component facilitates a flexible & extensible content container having multiple variants. It allows making an element containing a header and some content associated with that header.
Syntax:
<mdb-card>
<mdb-card-body>
<mdb-card-title>
<h2>Heading</h2>
<h5>Sub-heading</h5>
</mdb-card-title>
<mdb-card-text>Content</mdb-card-text>
</mdb-card-body>
</mdb-card>
Approach:
- Download Angular MDBootstrap from the official site.
- Extract the files to the current working directory.
- Install npm in the current project using the following command:
npm install
- After creating your project folder i.e. appname, move to it using the following command:
cd appname
- Start the server using the following command:
ng serve
Project Structure: After complete installation, it will look like the following:
Project Structure
Example 1: This is the basic example that illustrates how to use the Panels component in Angular MDBootstrap.
app.component.html
< div id = 'gfg' >
< mdb-card >
< mdb-card-body >
< mdb-card-title >
< h2 >GeeksforGeeks</ h2 >
< h5 >Panels Component</ h5 >
</ mdb-card-title >
< mdb-card-text >
MDBootstrap is a Material Design
and bootstrap-based Angular UI
library that is used to make good
looking webpages with its seamless
and easy-to-use component
</ mdb-card-text >
</ mdb-card-body >
</ mdb-card >
</ div >
|
app.component.ts
import { Component } from '@angular/core' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
styleUrls: [ './app.component.css' ]
})
export class AppComponent{}
|
app.module.ts
import { BrowserModule } from '@angular/platform-browser' ;
import { NgModule } from '@angular/core' ;
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations' ;
import { AppComponent } from './app.component' ;
import { MDBBootstrapModule } from 'angular-bootstrap-md' ;
import { FormsModule } from '@angular/forms' ;
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
MDBBootstrapModule.forRoot(),
FormsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule{}
|
Output:
Angular MDBootstrap Panels Componeclass=”aligncenter” alt=”Angular MDBootstrap Panels Component”nt
Example 2: This example illustrates how to add additional content to Panels Component.
app.component.html
< div id = 'gfg' >
< mdb-card class = "w-75 mb-3 text-right"
bgColor = "bg-success" >
< mdb-card-body >
< mdb-card-title >
< h2 >GeeksforGeeks</ h2 >
< h5 >Panels Component</ h5 >
</ mdb-card-title >
< mdb-card-text >
MDBootstrap is a Material Design
and bootstrap-based Angular UI
library that is used to make good
looking webpages with its seamless
and easy-to-use component
</ mdb-card-text >
</ mdb-card-body >
</ mdb-card >
</ div >
|
app.component.ts
import { Component } from '@angular/core' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
styleUrls: [ './app.component.css' ]
})
export class AppComponent{}
|
app.module.ts
import { BrowserModule } from '@angular/platform-browser' ;
import { NgModule } from '@angular/core' ;
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations' ;
import { AppComponent } from './app.component' ;
import { MDBBootstrapModule } from 'angular-bootstrap-md' ;
import { FormsModule } from '@angular/forms' ;
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
MDBBootstrapModule.forRoot(),
FormsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule{}
|
Output:
Adding the additional content to the Panels Component
Reference: https://mdbootstrap.com/docs/angular/components/panels
Last Updated :
07 Mar, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...