How can I help you?
Getting started with Angular AppBar component
6 Feb 20265 minutes to read
This section explains how to create a simple AppBar and demonstrates the basic usage of the AppBar module in an Angular environment.
Dependencies
The list of dependencies required to use the AppBar module in your application is given below:
|-- @syncfusion/ej2-angular-navigations
|-- @syncfusion/ej2-angular-base
|-- @syncfusion/ej2-navigations
|-- @syncfusion/ej2-baseSetup Angular environment
You can use Angular CLI to setup your Angular applications. To install Angular CLI use the following command.
npm install -g @angular/cli
Angular 21 Standalone Architecture: Standalone components are the default in Angular 21. This guide uses the modern standalone architecture. If you need more information about the standalone architecture, refer to the Standalone Guide.
Installing a specific version
To install a particular version of Angular CLI, use:
npm install -g @angular/[email protected]Create a new application
With Angular CLI installed, execute this command to generate a new application:
ng new syncfusion-angular-app- This command will prompt you to configure settings like enabling Angular routing and choosing a stylesheet format.
? Which stylesheet format would you like to use? (Use arrow keys)
> CSS [ https://developer.mozilla.org/docs/Web/CSS ]
Sass (SCSS) [ https://sass-lang.com/documentation/syntax#scss ]
Sass (Indented) [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]
Less [ http://lesscss.org ]- By default, a CSS-based application is created. Use SCSS if required:
ng new syncfusion-angular-app --style=scss- During project setup, when prompted for the Server-side rendering (SSR) option, choose the appropriate configuration.

- Select the required AI tool or ‘none’ if you do not need any AI tool.

- Navigate to your newly created application directory:
cd syncfusion-angular-appNote: In Angular 19 and below, it uses
app.component.ts,app.component.html,app.component.cssetc. In Angular 20+, the CLI generates a simpler structure withsrc/app/app.ts,app.html, andapp.css(no.component.suffixes).
Installing Syncfusion® AppBar Package
Syncfusion® packages are distributed in npm as @syncfusion scoped packages. You can get all the Angular Syncfusion® packages from npm link.
Currently, Syncfusion® provides two types of package structures for Angular components:
- Ivy library distribution package format
- Angular compatibility compiler(Angular’s legacy compilation and rendering pipeline) package.
Ivy library distribution package
Syncfusion® Angular packages(>=20.2.36) has been moved to the Ivy distribution to support the Angular Ivy rendering engine and the packages are compatible with Angular version 12 and above. To download the package use the below command.
Add @syncfusion/ej2-angular-navigations package to the application.
npm install @syncfusion/ej2-angular-navigations --saveAngular compatibility compiled package(ngcc)
For Angular version below 12, you can use the legacy (ngcc) package of the Syncfusion® Angular components. To download the ngcc package use the below command.
Add @syncfusion/ej2-angular-navigations@ngcc package to the application.
npm install @syncfusion/ej2-angular-navigations@ngcc --saveTo mention the ngcc package in the package.json file, add the suffix -ngcc with the package version as below.
@syncfusion/ej2-angular-navigations:"20.2.38-ngcc"Note: If the ngcc tag is not specified while installing the package, the Ivy Library Package will be installed and this package will throw a warning.
Adding Syncfusion® AppBar component
Modify the template in app.component.ts file with ejs-appbar to render the AppBar component.
import { AppBarModule } from '@syncfusion/ej2-angular-navigations'
import { Component } from "@angular/core";
@Component({
imports: [AppBarModule],
standalone: true,
selector: "app-root",
template: `<!-- To Render AppBar. -->
<div class="control-container">
<ejs-appbar colorMode="Primary">
<button #regularBtn ejs-button cssClass="e-inherit menu" iconCss="e-icons e-menu"></button>
<span class="regular">Angular AppBar</span>
<div class="e-appbar-spacer"></div>
<button ejs-button cssClass="e-inherit login">FREE TRIAL</button>
</ejs-appbar>
</div>`
})
export class AppComponent { }Adding CSS reference
Add AppBar component’s styles as given below in style.css.
@import "../node_modules/@syncfusion/ej2-base/styles/material3";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material3";Running the application
Run the application in the browser using the following command:
ng serve
The following example shows a basic AppBar component.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { AppBarModule } from '@syncfusion/ej2-angular-navigations'
import { ButtonModule } from '@syncfusion/ej2-angular-buttons'
import { Component } from "@angular/core";
@Component({
imports: [ AppBarModule, ButtonModule],
standalone: true,
selector: "app-root",
template: `<!-- To Render AppBar. -->
<div class="control-container">
<ejs-appbar colorMode="Primary">
<button #regularBtn ejs-button cssClass="e-inherit" iconCss="e-icons e-menu"></button>
<span class="regular" style="margin:0 5px">Angular AppBar</span>
<div class="e-appbar-spacer"></div>
<button ejs-button cssClass="e-inherit">FREE TRIAL</button>
</ejs-appbar>
</div>`,
})
export class AppComponent {}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));