Angular PrimeNG DataView Styling
Last Updated :
26 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. In this article, we will know how to use the DataView Styling in Angular PrimeNG.
The DataView Component is used to display data in a grid and list layout with pagination and sorting features. The Styling classes are used to add some CSS styles on DataView components.
Angular PrimeNG DataView Styling:
- p-dataview: It is a styling Container element.
- p-dataview-list: It is a styling Container element in the list layout.
- p-dataview-grid: It is a styling Container element in the grid layout.
- p-dataview-header: It is a styling Header section.
- p-dataview-footer: It is a styling Footer section.
- p-dataview-content: It is a styling Container of items.
- p-dataview-emptymessage: It is a styling Empty message element.
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: To run the above file run the below command:
ng serve --save
Example 1: This is the basic example that shows how to use the DataView Styling.
HTML
<h1 style="color: green">GeeksforGeeks</h1>
<h5>Angular PrimeNG DataView Styling</h5>
<div class="card">
<p-dataView
#dv [value]="gfg" [paginator]="true"
[rows]="4" filterBy="name" layout="grid">
<ng-template pTemplate="header">
<p-dataViewLayoutOptions>
</p-dataViewLayoutOptions>
</ng-template>
<ng-template let-product pTemplate="gridItem">
<div class="p-col-12 p-md-4">
<div class="product-grid-item">
<button pButton pRipple type="button"
label="GeeksforGeeks"
class="p-button-success">
</button>
</div>
</div>
</ng-template>
</p-dataView>
</div>