Angular PrimeNG Timeline Component
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. This article will show us how to use the Timeline Component in Angular PrimeNG. We will also learn about the various properties and syntaxes used in the code example.
- The TimeLine component is used to display the timeline of the process.
- TimeLine Left Align is used to align the series of chained processes to the left side.
- TimeLine Right Align is used to align the series of chained processes to the right side.
- TimeLine Alternate Align is used to align the series of chained processes alternatively.
- TimeLine Opposite Content is used to align the series of processes in Opposite Content.
- TimeLine Customized is used to customize the series of processes.
- TimeLine Horizontal is used to align the series of processes horizontally. It is further categorized as Top align, Bottom align, and Alternate align.
- TimeLine Layout is used to set the layout of the processes to horizontal. The default layout is vertical.
- TimeLine Alignment is used to specify where the timeline bar will be located.
- Timeline Opposite is used to define the content that will be displayed on the opposite side of the bar.
- An alternative event marker can be used in place of the standard one using the marker template.
Angular PrimeNG TimeLine Component Properties:
- value: It is an array of events to display. It is of array data type & the default value is null.
- align: It is the position of the timeline bar relative to the content. It is of string data type & the default value is left.
- layout: It is the orientation of the timeline. It is of string data type & the default value is vertical.
- style: It is the inline style of the component. It is of string 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.
Angular PrimeNG TimeLine Component Styling:
- p-timeline: It is the container element.
- p-timeline-left: It is the container element when alignment is left.
- p-timeline-right: It is the container element when alignment is right.
- p-timeline-top: It is the container element when alignment is top.
- p-timeline-bottom: It is the container element when alignment is bottom.
- p-timeline-alternate: It is the container element when alignment is alternating.
- p-timeline-vertical: It is the container element of a vertical timeline.
- p-timeline-horizontal: It is the container element of a horizontal timeline.
- p-timeline-event: It is the event element.
- p-timeline-event-opposite: It is the opposite of event content.
- p-timeline-event-content: It is the event content.
- p-timeline-event-separator: It is the separator element of an event.
- p-timeline-event-marker: It is the marker element of an event.
- p-timeline-event-connector: It is the connector element of an event.
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: Below is the example that illustrates the use of Angular PrimeNG Timeline Component.
HTML
<h1 style="color: green">GeeksforGeeks</h1>
<h5>Angular PrimeNG Timeline Layout</h5>
<p-timeline [value]="gfg" layout="vertical">
<ng-template pTemplate="content" let-event>
{{event}}
</ng-template>
</p-timeline>
JavaScript
import { Component } from "@angular/core";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"]
})
export class AppComponent {
gfg: any[];
ngOnInit() {
this.gfg = [
"DSA Self Paced",
"C++ STL",
"System Design",
"Java"
];
}
}
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { TimelineModule } from 'primeng/timeline';
import { CardModule } from 'primeng/card';
import { ButtonModule } from 'primeng/button';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ButtonModule,
TimelineModule,
CardModule,
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
Output:
Example 2: Below is another example that illustrates the use of Angular PrimeNG Timeline Component.
HTML
<h1 style="color: green">GeeksforGeeks</h1>
<h5>Angular PrimeNG Timeline Layout</h5>
<p-timeline [value]="gfg" layout="horizontal">
<ng-template pTemplate="content" let-event>
{{event}}
</ng-template>
</p-timeline>
JavaScript
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { TimelineModule } from 'primeng/timeline';
import { CardModule } from 'primeng/card';
import { ButtonModule } from 'primeng/button';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ButtonModule,
TimelineModule,
CardModule,
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
JavaScript
import { Component } from "@angular/core";
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.scss"]
})
export class AppComponent {
gfg: any[];
ngOnInit() {
this.gfg = [
"DSA Self Paced",
"C++ STL",
"System Design",
"Java"
];
}
}
Output:
Reference: https://primefaces.org/primeng/timeline
Similar Reads
Angular PrimeNG TimeLine 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 TimeLine Component in Angular PrimeNG. We will also lea
4 min read
Angular PrimeNG Tree 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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
6 min read
Angular PrimeNG Table 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. It provides a lot of templates, components, theme design, an extensive icon library, and much more.
10 min read
Angular PrimeNG Slider 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 slider component in Angular PrimeNG. Properties: animat
4 min read
Angular PrimeNG Timeline Opposite
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 Timeline Opposite in Angular PrimeNG. We will also learn ab
3 min read
Angular PrimeNG SlideMenu 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 how to use the SlideMenu component in Angular PrimeNG. We will also lea
5 min read
Angular PrimeNG Steps 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 Steps component in Angular PrimeNG. We will also learn
3 min read
Angular PrimeNG Timeline Customized
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 how to use the Timeline Customized Component in Angular PrimeNG. The
4 min read
Angular PrimeNG Sidebar 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 Sidebar component in Angular PrimeNG. We will also lear
5 min read
Angular PrimeNG Timeline Layout
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 Timeline Layout in Angular PrimeNG. We will also learn abou
3 min read