Open In App

Angular PrimeNG Divider Component

Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the Divider component in Angular PrimeNG. We will also learn about the properties, styling along with their syntaxes that will be used in the code. 

Divider Component: It is used to make a component that divides the content using a divider.



Properties:

Styling:



 

Creating Angular application & module installation:

ng new appname
cd appname
npm install primeng --save
npm install primeicons --save

Project Structure: It will look like the following:

Example 1: This is the basic example that illustrates how to use the Divider component.




<h2>GeeksforGeeks</h2>
<h5>PrimeNG Divider Component</h5>
<div>
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider>
    <b>Divider</b>
  </p-divider>
  
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider>
    <b>Divider</b>
  </p-divider>
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider>
    <b>Divider</b>
  </p-divider>
  <p>
    Angular PrimeNG is a 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.
  </p>
</div>




import { Component } from '@angular/core';
  
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {}




import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } 
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { DividerModule } from "primeng/divider";
  
@NgModule({
  imports: [BrowserModule, 
              BrowserAnimationsModule, 
            DividerModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

Output:

Example 2: In this example, we will know how to use align property in the divider component.




<h2>GeeksforGeeks</h2>
<h5>PrimeNG Divider Component</h5>
<div>
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider align="right" type="dashed">
    <b>Divider</b>
  </p-divider>
  
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider align="center" type="dashed">
    <b>Divider</b>
  </p-divider>
  <p>
    Angular PrimeNG is a 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.
  </p>
  
  <p-divider align="left" type="dashed">
    <b>Divider</b>
  </p-divider>
  <p>
    Angular PrimeNG is a 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.
  </p>
</div>




import { Component } from '@angular/core';
  
@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {}




import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } 
    from "@angular/platform-browser/animations";
import { AppComponent } from "./app.component";
import { DividerModule } from "primeng/divider";
  
@NgModule({
  imports: [BrowserModule, 
              BrowserAnimationsModule, 
            DividerModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

Output:

Reference: https://primeng.org/divider


Article Tags :