Open In App

Angular PrimeNG Divider Vertical with Content

Last Updated : 09 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 Vertical with Content in Angular PrimeNG. We will also learn about the properties, and style along with their syntaxes that will be used in the code.

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

Angular PrimeNG Divider Vertical with Content properties:

  • type: It is the border style type. It has 3 possible values i.e. dashed, dotted, and solid. It is of string data type & the default value is solid.
  • align: It is used to set the alignment of the content. It is of string data type & the default value is null.
  • layout: It is used to specify the orientation. It is of string data type & the default value is horizontal.
  • style: It is the inline style of the component. It is of object data type & the default value is null.
  • styleClass: It is the style class of the component. It is of string data type & the default value is null.

Syntax:

<div class="p-grid">
    <div class="p-col-5 p-d-flex 
        p-ai-center p-jc-center">
          ...
    </div>

    <div class="p-col-2">
      <p-divider layout="vertical">
        ...
      </p-divider>
    </div>

    <div class="p-col-5 p-d-flex 
        p-ai-center p-jc-center">
          ...
    </div>
</div>

Creating Angular application & module installation:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: It will look like the following:

 

Run the below command to see the output.

ng serve --open

Example 1: This is the basic example code that illustrates the use of Angular PrimeNG Divider Vertical with Content.

app.component.html




<div style="text-align: center">
  <h2 style="color: green">GeeksforGeeks</h2>
  <h5>PrimeNG Divider Vertical with Content</h5>
</div>
  
<div class="p-grid">
  <div class="p-col-4 p-d-flex p-ai-center 
     p-jc-center">
    <div class="p-fluid">
      <div class="p-field">
        <input
          placeholder="Enter the Email"
          pInputText
          id="email"
          type="email"
        />
      </div>
  
      <div class="p-field">
        <input
          placeholder="Enter the Password"
          pInputText
          id="password"
          type="password"
        />
      </div>
  
      <div class="p-field">
        <input
          placeholder="Re-Enter the Password"
          pInputText
          id="password"
          type="password"
        />
      </div>
  
      <p-button styleClass="p-button-success" 
        label="SignUp to GfG"
      </p-button>
    </div>
  </div>
  
  <div class="p-col-4">
    <p-divider layout="vertical">
      <b>OR</b>
    </p-divider>
  </div>
  
  <div class="p-col-4 p-d-flex p-ai-center 
     p-jc-center">
    <div class="p-fluid">
      <div class="p-field">
        <input
          placeholder="Enter the Email"
          pInputText
          id="email"
          type="email"
        />
      </div>
  
      <div class="p-field">
        <input
          placeholder="Enter the Password"
          pInputText
          id="password"
          type="password"
        />
      </div>
  
      <p-button styleClass="p-button-success" 
        label="Login to GfG"
      </p-button>
    </div>
  </div>
</div>


app.component.ts




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html"
})
  
export class AppComponent {}


app.module.ts




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";
import { ButtonModule } from "primeng/button";
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}


Output:

 

Example 2: Below is another example that illustrates the use of Angular PrimeNG Divider Vertical with Content as images.

app.component.html




<div style="text-align: center">
  <h2 style="color: green">GeeksforGeeks</h2>
  <h5>PrimeNG Divider Vertical with Content</h5>
</div>
  
<div class="p-grid">
  <div class="p-col-5 p-d-flex 
     p-ai-center p-jc-center">
    <img alt="gfg" src=
  </div>
  
  <div class="p-col-2">
    <p-divider layout="vertical">
      <b>OR</b>
    </p-divider>
  </div>
  
  <div class="p-col-5 p-d-flex 
     p-ai-center p-jc-center">
    <img alt="gfg" src=
  </div>
</div>


app.component.ts




import { Component } from "@angular/core";
  
@Component({
    selector: "app-root",
    templateUrl: "./app.component.html"
})
  
export class AppComponent {}


app.module.ts




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";
import { ButtonModule } from "primeng/button";
  
@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    DividerModule,
    ButtonModule
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule {}


Output:

 

Reference: https://primefaces.org/primeng/divider



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads