Angular playground

Nova v3.38.0

Preview

Angular

Installation

Install Nova, configure Tailwind CSS and themes, and render your first component.

npm install @nova-design-system/nova-angular @nova-design-system/nova-base
  • Angular 21 or newer
  • 2 npm packages
  • 5 steps to your first component

New to Nova? Read Getting Started

Install Nova in an Angular application, configure Tailwind CSS v4 with a Nova theme, register the Nova providers, and render your first component.

Requirements#

  • Angular 21 or newer — @nova-design-system/nova-angular is the only actively supported Angular package. Angular 20 and older are no longer supported by new Nova releases.

1. Install packages#

Install the Angular wrapper and Nova Base package:

bashnpm install @nova-design-system/nova-angular @nova-design-system/nova-base

@nova-design-system/nova-webcomponents is installed automatically by @nova-design-system/nova-angular. Install it directly only if your application imports from it outside the Angular wrapper.

Elia developer VMs

If you encounter SSL certificate errors on a developer VM, run npm config set strict-ssl false as documented in the Developer Setup guide.

2. Set up Tailwind CSS and themes#

Nova Angular uses Tailwind CSS v4 as its styling layer. Let the Angular CLI create the base Tailwind setup whenever possible.

  • New Angular apps:

    bashng new my-app --style=tailwind
    
  • Existing Angular apps:

    bashng add tailwindcss
    
Manual Tailwind setup fallback (without Angular CLI)

Install Tailwind CSS and its PostCSS plugin:

bashnpm install -D tailwindcss @tailwindcss/postcss postcss

Create .postcssrc.json at the project root:

json{
  "plugins": {
    "@tailwindcss/postcss": {}
  }
}

Import Tailwind, the Nova plugin, and one theme#

Update src/styles.css to import Tailwind, Nova's CSS-only plugin, and exactly one token theme (spark.css or ocean.css):

css@import 'tailwindcss';
@import '@nova-design-system/nova-base/theme/plugin.css';
@import '@nova-design-system/nova-base/dist/css/spark.css';
/* Or import ocean.css instead of spark.css. */

No tailwind.config file, @config, @plugin, or extra angular.json stylesheet entry is required. Do not import @nova-design-system/nova-base/dist/css/nova-utils.css alongside Tailwind.

Dark mode#

Add the dark class to <body> (or another root element) to switch semantic tokens and components to dark mode:

html<body class="dark">
Deprecated JavaScript Tailwind configuration

The previous JavaScript theme and plugin remain available for backward compatibility. Do not combine this setup with theme/plugin.css.

Create tailwind.config.ts at the project root:

tsimport type { Config } from 'tailwindcss';
import { novaTailwindTheme } from '@nova-design-system/nova-base/theme';

export default {
  theme: novaTailwindTheme,
} satisfies Config;

Update src/styles.css:

css@import 'tailwindcss';

@config '../tailwind.config.ts';
@plugin '@nova-design-system/nova-base/theme/plugin';
@custom-variant dark (&:where(.dark, .dark *));

Then add @nova-design-system/nova-base/dist/css/spark.css (or ocean.css) to the styles array in angular.json. Add "type": "module" to package.json if Node emits a MODULE_TYPELESS_PACKAGE_JSON warning for tailwind.config.ts.

3. Register Nova components#

Standalone apps (default)#

Call provideNovaComponents() in src/app/app.config.ts:

tsimport { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideNovaComponents } from '@nova-design-system/nova-angular';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [
    provideBrowserGlobalErrorListeners(),
    provideRouter(routes),
    provideNovaComponents(),
  ],
};

Import NovaComponentsModule in each standalone component that uses Nova components (add NovaComponentsValueAccessorModule alongside FormsModule or ReactiveFormsModule when binding form controls):

tsimport { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import {
  NovaComponentsModule,
  NovaComponentsValueAccessorModule,
} from '@nova-design-system/nova-angular';

@Component({
  selector: 'app-root',
  imports: [
    FormsModule,
    NovaComponentsModule,
    NovaComponentsValueAccessorModule,
  ],
  templateUrl: './app.html',
})
export class App {
  name = '';
  greeting = '';

  greet() {
    this.greeting = this.name ? `Hello, ${this.name}.` : 'Hello from Nova.';
  }
}
NgModule-based apps

Import NovaComponentsModule (and NovaComponentsValueAccessorModule for forms) and add provideNovaComponents() to providers:

tsimport { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import {
  NovaComponentsModule,
  NovaComponentsValueAccessorModule,
  provideNovaComponents,
} from '@nova-design-system/nova-angular';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    FormsModule,
    NovaComponentsModule,
    NovaComponentsValueAccessorModule,
  ],
  providers: [provideNovaComponents()],
  bootstrap: [AppComponent],
})
export class AppModule {}

4. Add Nova Font Pro#

Protected asset

Nova Font Pro (TT Norms Pro) is a licensed Elia Group asset and is not bundled in @nova-design-system/nova-base. Get the stylesheet URL from the Nova internal wiki or ask the Nova team on Teams.

Add the font URL to the styles array in angular.json (recommended):

json"styles": [
  "src/styles.css",
  "contact-us-for-URL/nova-fonts-pro.css"
]

Alternatively, import it in src/styles.css with @import url('contact-us-for-URL/nova-fonts-pro.css'); or add a <link rel="stylesheet"> tag in src/index.html.

5. Render your first component#

Use nv-* tags directly in your Angular template with Angular property, event, and two-way bindings:

html<div class="flex max-w-md flex-col gap-4 p-6">
  <nv-fieldtext
    label="Name"
    placeholder="Enter your name"
    [(ngModel)]="name"
    name="name"
  ></nv-fieldtext>

  <nv-button emphasis="high" (click)="greet()">
    Say hello
  </nv-button>

  @if (greeting) {
    <nv-alert feedback="information" [heading]="greeting"></nv-alert>
  }
</div>

Working with slots#

Place default slot content directly inside a component. For named slots, add the slot attribute to the slotted element:

html<nv-button emphasis="medium">
  <nv-icon name="download" slot="leading-icon" aria-hidden="true"></nv-icon>
  Export report
  <nv-icon name="arrow-right" slot="trailing-icon" aria-hidden="true"></nv-icon>
</nv-button>

Notifications#

To show toast notifications from NotificationService, import NovaComponentsProvidersModule and render <nv-notification-service position="top-right"></nv-notification-service> once near your application root. See Notifications for the complete setup.

Next steps#