Angular PrimeNG OrganizationChart 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. It provides a lot of templates, components, theme design, an extensive icon library, and much more. In this article, we will see the Angular PrimeNG OrganizationChart Styling.
The OrganizationChart Component visualizes the data in hierarchical organizational data. The data is arranged in the tree format. The component provides a lot of properties, styling, events, templates, etc. which can be modified to create many variations.
Styling: This component provides the list of structural style classes, that increase the overall user experience.
Angular PrimeNG OrganizationChart Styling:
- p-organizationchart: It is the container element.
- p-organizationchart-table: It is the table container of the node.
- p-organizationchart-lines: It is the connector lines container.
- p-organizationchart-nodes: It is the contained of node children.
- p-organizationchart-line-right: It is the right side line of a node connector.
- p-organizationchart-line-left: It is the left side line of a node connector.
- p-organizationchart-line-top: It is the side line of a node connector.
Creating Angular application & Module Installation:
Step 1: Create an Angular application using the following command.
ng new geeks_angular
Step 2: After creating your project folder i.e. geeks_angular, move to it using the following command.
cd geeks_angular
Step 3: Install PrimeNG in your given directory.
npm install primeng --save
npm install primeicons --save
Project Structure: The project structure 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 example that illustrates the use of the Angular PrimeNG OrganizationChart Styling using styleClass=’myClass’ in the app.component.html file.
HTML
< h1 style = "color: green; text-align:center;" >
GeeksforGeeks
</ h1 >
< h3 >Angular PrimeNG OrganizationChart Styling</ h3 >
< p-organizationChart
[value]="GfG"
styleClass = "myClass" >
</ p-organizationChart >
|
Javascript
import { Component } from '@angular/core' ;
import { TreeNode } from 'primeng/api' ;
import { MessageService } from 'primeng/api' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
providers: [MessageService],
styleUrls: [ './app.component.scss' ]
})
export class AppComponent {
GfG: TreeNode[];
constructor(private messageService: MessageService) { }
ngOnInit() {
this .GfG = [
{
label: 'Data Structures and Algorithms' ,
expanded: true ,
children: [
{
label: 'Data Structures' ,
expanded: true ,
children: [
{
label: 'Queue' , type: 'gfg'
},
{
label: 'Red-Black Tree' , type: 'gfg'
},
],
},
{
label: 'Algorithms' ,
expanded: true ,
children: [
{
label: 'Hashing' , type: 'gfg'
},
{
label: 'Divide and Conquer' , type: 'gfg'
},
],
},
],
},
];
}
}
|
Javascript
import { NgModule } from '@angular/core' ;
import { BrowserModule }
from '@angular/platform-browser' ;
import { FormsModule } from '@angular/forms' ;
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations' ;
import { AppComponent }
from './app.component' ;
import { OrganizationChartModule }
from 'primeng/organizationchart' ;
import { ToastModule } from 'primeng/toast' ;
import { PanelModule } from 'primeng/panel' ;
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
OrganizationChartModule,
ToastModule,
PanelModule,
FormsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
|
CSS
:host ::ng-deep .myClass{
border : 2px solid green ;
}
|
Output:
Example 2: Below is another example that illustrates the use of the Angular PrimeNG OrganizationChart Styling using styleClass: ‘myClass’ in the app.component.ts file.
HTML
< h1 style = "color: green; text-align:center;" >
GeeksforGeeks
</ h1 >
< h3 >Angular PrimeNG OrganizationChart Styling</ h3 >
< p-organizationChart
[value]="GfG">
</ p-organizationChart >
|
Javascript
import { Component } from '@angular/core' ;
import { TreeNode } from 'primeng/api' ;
import { MessageService } from 'primeng/api' ;
@Component({
selector: 'app-root' ,
templateUrl: './app.component.html' ,
providers: [MessageService],
styleUrls: [ './app.component.scss' ]
})
export class AppComponent {
GfG: TreeNode[];
constructor(private messageService: MessageService) { }
ngOnInit() {
this .GfG = [
{
label: 'Data Structures and Algorithms' ,
expanded: true ,
styleClass: 'myClass' ,
children: [
{
label: 'Data Structures' ,
expanded: true ,
styleClass: 'myClass' ,
children: [
{
label: 'Queue' , styleClass: 'myClass' , type: 'gfg'
},
{
label: 'Red-Black Tree' ,
styleClass: 'myClass' , type: 'gfg'
},
],
},
{
label: 'Algorithms' ,
styleClass: 'myClass' ,
expanded: true ,
children: [
{
label: 'Hashing' , styleClass: 'myClass' , type: 'gfg'
},
{
label: 'Divide and Conquer' ,
styleClass: 'myClass' ,
type: 'gfg'
},
],
},
],
},
];
}
}
|
Javascript
import { NgModule } from '@angular/core' ;
import { BrowserModule }
from '@angular/platform-browser' ;
import { FormsModule } from '@angular/forms' ;
import { BrowserAnimationsModule }
from '@angular/platform-browser/animations' ;
import { AppComponent }
from './app.component' ;
import { OrganizationChartModule }
from 'primeng/organizationchart' ;
import { ToastModule } from 'primeng/toast' ;
import { PanelModule } from 'primeng/panel' ;
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
OrganizationChartModule,
ToastModule,
PanelModule,
FormsModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
|
CSS
:host ::ng-deep .myClass{
border : 2px solid green ;
}
|
Output:
Reference: https://primefaces.org/primeng/organizationchart
Similar Reads
Angular PrimeNG OrganizationChart Templating
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 OrganizationChart Selection
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.
3 min read
Angular PrimeNG OrganizationChart Properties
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 OrganizationChart Basic
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.
3 min read
Angular PrimeNG OrganizationChart Events
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 OrganizationChart Advanced
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 OrganizationChart 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.
4 min read
Angular PrimeNG Styling of Avatar
Angular PrimeNG is a collection of Interactive UI components for Angular applications. Developers can use these components to make beautiful and responsive web interfaces in no time as most of the components have all the necessary functions implemented. In this article, we will be discussing Angular
3 min read
Angular PrimeNG OrderList Styling
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 the Angular PrimeNG OrderList Styling. The OrderList Component is used
2 min read
Angular PrimeNG Dialog Styling
A responsive website may be created with great ease using the open-source Angular PrimeNG framework, which has a wide range of native Angular UI components for superb style. In this article, we will learn how to style the Dialog Styling in Angular PrimeNG. The Dialog component is used to create a c
4 min read