Angular 22 · Components and templates

Toggle a CSS class

Add a class when a condition is true.

<li [class.active]="isActive">Item</li>

Official Angular 22 documentation

More components and templates commands

All components and templates commands · Angular 22 cheatsheet

Was this page helpful?