Open In App

Angular PrimeNG Form Editor Styling 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 see Angular PrimeNG Form Editor Styling Component.

The Form Editor is a Quill-based rich text editor component. The Styling Component helps to make the interactive Form Editor Styling by implementing the different stylings provided by Angular PrimeNG.



Angular PrimeNG Form Editor Styling Component: These styling components are described below:

Syntax:



<p-editor 
    [style]="{...}">
</p-editor>

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
npm install quill --save

Project Structure: It will look like the following:

 

ng serve --save

Example 1: In this example, we will learn about Angular PrimeNG Form Editor Styling with the p-editor-container and p-editor-toolbar classes. 




<head>
    <link href=
          rel="stylesheet">
</head>
  
<div style="width:80%">
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h2>
        Angular PrimeNG Form
        Editor Styling Component
    </h2>
    <p-editor [style]="{ height: '120px' }">
    </p-editor>
</div>




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




import { NgModule } from '@angular/core';
import { BrowserModule }
    from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule }
    from '@angular/platform-browser/animations';
import { EditorModule } from 'primeng/editor';
import { AppComponent } from './app.component';
import { InputMaskModule } from 'primeng/inputmask';
  
@NgModule({
    imports: [
        EditorModule,
        BrowserModule,
        BrowserAnimationsModule,
        InputMaskModule,
        FormsModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
  
export class AppModule { }

Output:

 

Example 2: In this example, we will learn about Angular PrimeNG Form Editor Styling p-editor-content with predefined content.




<head>
    <link href=
         rel="stylesheet">
</head>
<div style="width:80%">
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
    <h2>
        Angular PrimeNG Form Editor Styling Component
    </h2>
    <p-editor [style]="{ height: '120px' }"
              [(ngModel)]="gfg">
    </p-editor>
</div>




import { Component } from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
})
  
export class AppComponent {
    gfg: string = `
    <div>GeeksforGeeks!</div>
    <div>It is a Computer Science Portal</div>
    <div><br></div>`;
}




import { NgModule } from '@angular/core';
import { BrowserModule }
    from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule }
    from '@angular/platform-browser/animations';
import { EditorModule } from 'primeng/editor';
import { AppComponent } from './app.component';
import { InputMaskModule } from 'primeng/inputmask';
  
@NgModule({
    imports: [
        EditorModule,
        BrowserModule,
        BrowserAnimationsModule,
        InputMaskModule,
        FormsModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
  
export class AppModule { }

Output:

 

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


Article Tags :