
Angular 20.2 introduces a delightfully simple way to animate elements as they enter and leave the screen. With zero imports and CSS doing all the heavy lifting, the new animate.enter and animate.leave attributes let you add smooth, modern transitions with minimal code and maximum sanity.
Alain Chautard
December 26, 2025
In Angular 20.2, CSS animations for transitions have evolved with a fairly simple API.
Let’s dive into it.
Here is an example of animation for an element entering the screen:

The first thing to know is that animations are 100% driven by CSS. If you’re not familiar with CSS animations, you can use the CSS animation generator mentioned in this post.
Note that AI tools can also assist you in generating proper CSS animations. In the case of the example above, I used the following CSS code:
.entering {
animation: slide-fade 2s;
}
@keyframes slide-fade {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
The code is almost self-explanatory: We transition from an opacity of 0 (invisible) 30 pixels from the bottom to an opacity of 1 (fully visible) at the right position, and this animation lasts for 2 seconds.

Once the CSS class is ready, all that is left to do is tell Angular to use it. Here is how:
<div class="enter-container" animate.enter="entering">
<p>I'm animated!</p>
</div>
That’s it! animate.enter is a specific attribute supported by the Angular compiler. It’s not a directive, which means no import needed. You can use it as-is.
Another attribute called animate.leave can be added as well.
Let’s create another transition to use when hiding the element:
.leaving {
opacity: 0;
transform: translateX(20px);
transition: opacity 500ms ease-out, transform 500ms ease-out;
}
This one moves to the side by 20 pixels and lasts 500 ms. We apply it by adding animate.leave to our element:
<div class="enter-container"
animate.enter="entering"
animate.leave="leaving">
<p>I'm animated!</p>
</div>
And that is how our element supports animations. You can find the full code example on Stackblitz here.
Note that if you want to animate entire routes rather than single elements, you can still use the API described in this tutorial of mine, which has been available since Angular 17.
Get the latest news and updates on developer certifications. Content is updated regularly, so please make sure to bookmark this page or sign up to get the latest content directly in your inbox.

JavaScript Mistakes That Quietly Destroy Production Apps
Some JavaScript mistakes don’t crash your app, they slowly degrade performance, reliability, and user trust. Here are the ones that cost the most in production.
Martin Ferret
Feb 19, 2026

Build Stronger Engineering Standards For Your Team
Standardise engineering standards in an AI-accelerated environment. Certificates.dev for Teams adds a Team Dashboard, reporting, and procurement-friendly purchasing.
Kristen Abrahams
Feb 19, 2026

Supercharging Nuxt Apps with VueUse
Nuxt encourages composables and VueUse gives you really good ones. If you’re building Nuxt apps and not using VueUse yet, you’re probably working harder than you need to.
Reza Baar
Feb 17, 2026
We can help you recruit Certified Developers for your organization or project. The team has helped many customers employ suitable resources from a pool of 100s of qualified Developers.
Let us help you get the resources you need.
