Angular PrimeNG Panel Templates
Last Updated :
24 Apr, 2025
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. This article will show us how to use the Panel Templates in Angular PrimeNG.
The Panel Component allows us to make an element containing a header and some content associated with that header.
This article will show the Panel Templating in Angular PrimeNG. The templates are used to put some content on some pre-structured containers.
Panel templates are discussed below:
- header: This is used to place the header of the Panel component.
- content: This is used to place the content of the Panel component.
- icons: This is used to place the icons of the Panel component.
- footer: This is used to place the footer of the Panel component.
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:
Steps to run the application: Run the below command to see the output
ng serve --save
Example 1: Below is the basic example demonstrating the use of Angular PrimeNG Panel Templates using header and icons pTemplate.
HTML
<h1 style="color: green">GeeksforGeeks</h1>
<h3>Angular PrimeNG Panel Template</h3>
<p-panel [toggleable]="true">
<ng-template pTemplate="header">
GeeksforGeeks
</ng-template>
<ng-template pTemplate="icons">
<button pButton class="p-panel-header-icon
p-link" icon="pi pi-code"
(click)="menu.toggle($event)">
</button>
<p-menu #menu [model]="gfg"
[popup]="true"></p-menu>
</ng-template>
<p>
Welcome to Geeks For Geeks! Billions of Users,
Millions of Articles Published, Thousands Got
Hired by Top Companies and the numbers are still
growing.
</p>
</p-panel>
JavaScript
import { Component } from '@angular/core';
import {MessageService} from 'primeng/api';
import {MenuItem} from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
providers: [MessageService]
})
export class AppComponent {
gfg: MenuItem[];
constructor(private messageService: MessageService) {}
ngOnInit() {
this.gfg = [
{
label: 'Languages',
items: [
{
label: 'C++'
},
{
label: 'Java'
},
{
label: 'Python'
},
{
label: 'C#'
}
]},
];
}
}
JavaScript
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { PanelModule } from 'primeng/panel';
import { ButtonModule } from 'primeng/button';
import { MenuModule } from 'primeng/menu';
@NgModule({
imports: [
BrowserAnimationsModule,
PanelModule,
ButtonModule,
MenuModule,
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Output:
Example 2: Below is another example demonstrating the use of Angular PrimeNG Panel Templates using footer and content pTemplate.
HTML
<h1 style="color: green">GeeksforGeeks</h1>
<h3>Angular PrimeNG Panel Template</h3>
<p-panel [toggleable]="true">
<ng-template pTemplate="header">
GeeksforGeeks
</ng-template>
<ng-template pTemplate="icons">
<button pButton class="p-panel-header-icon
p-link" icon="pi pi-code"
(click)="menu.toggle($event)">
</button>
<p-menu #menu [model]="gfg" [popup]="true"></p-menu>
</ng-template>
<ng-template pTemplate="content">
<p>
Welcome to Geeks For Geeks! Billions of Users,
Millions of Articles Published, Thousands Got
Hired by Top Companies and the numbers are still
growing.
</p>
</ng-template>
<ng-template pTemplate="footer">
Copyright@GeeksforGeeks
</ng-template>
</p-panel>
JavaScript
import { Component } from '@angular/core';
import {MessageService} from 'primeng/api';
import {MenuItem} from 'primeng/api';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
providers: [MessageService]
})
export class AppComponent {
gfg: MenuItem[];
constructor(private messageService: MessageService) {}
ngOnInit() {
this.gfg = [
{
label: 'Languages',
items: [
{
label: 'C++'
},
{
label: 'Java'
},
{
label: 'Python'
},
{
label: 'C#'
}
]},
];
}
}
JavaScript
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { PanelModule } from 'primeng/panel';
import { ButtonModule } from 'primeng/button';
import { MenuModule } from 'primeng/menu';
@NgModule({
imports: [
BrowserAnimationsModule,
PanelModule,
ButtonModule,
MenuModule,
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Output:
Reference: https://primefaces.org/primeng/panel
Similar Reads
Angular PrimeNG Inplace Templates
Angular PrimeNG is a UI component catalog for angular applications. It consists of a wide range of UI components that help in making fast and scalable websites. In this article, we will see Inplace Templates in Angular PrimeNG. The Inplace component is used to edit and display the content in place o
3 min read
Angular PrimeNG Image Templates
Angular PrimeNG is an open-source library that consists 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 discuss Angular PrimeNG Image Templates. The Image Component is used to show an
3 min read
Angular PrimeNG Dialog Templates
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 Dialog Templates in Angular PrimeNG. The Dialog Compone
3 min read
Angular PrimeNG Carousel Templates
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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
4 min read
Angular PrimeNG Card Templates
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. This article will show us how to use the Card Templates in Angular PrimeNG. The Card Component is us
3 min read
Angular PrimeNG Galleria Templates
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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
4 min read
Angular PrimeNG Fieldset Templates
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 how to use the different available Fieldset Templates in Angular PrimeN
3 min read
Angular PrimeNG Messages Templates
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 learn about Angular PrimeNG Messages Templates The messages component is us
3 min read
Angular PrimeNG DataView Templates
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 DataView Templates in Angular PrimeNG. Â The DataView C
3 min read
Angular PrimeNG PickList Templates
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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
4 min read