
Intermediate workshop
Nx for Scalable Architecture November
Master Nx to enforce architecture, speed up your development workflow and improve code quality
Learn more
Welcome back to our design token series! In our previous entries, we’ve explored the concept of extracting design tokens from Figma. Today, we talk about applying the design tokens by creating Angular components.

In the last blog post, we ended with SCSS files containing variables. To apply this variables, we map this variables to the SCSS files of the created components. Having a nicely structured SCSS allows to switch between styles/variants without requiring any adaption of the component.
This means, with a smart conversion we retrieve a SCSS file as follows
and can apply this SCSS inside the Angular component as follows
Performance considerations are crucial when developing components for modern web applications. Understanding and optimizing the amount of Document Object Model (DOM) elements and the usage of CSS selectors can significantly impact the performance and user experience of your application.
The DOM represents the page structure, and each element is a node in this tree-like structure. A large DOM can slow down your application because more nodes mean more work for the browser to layout, render, and repaint as users interact with the page. Here are some strategies to consider:
Simplify Your Structure: Use fewer, more semantic HTML elements. Aim for a cleaner, more efficient structure that accomplishes the same result.
Remove Non-Essential Elements: Analyze your DOM and remove any elements that don’t contribute to the user experience or could be replaced with more efficient CSS.
Virtualize Long Lists: If you have long lists or tables, consider using a virtualization library to only render items in view. For example, I can highly recommend Virtual Scrolling from RxAngular.
CSS selectors are a powerful way to apply styles to your elements, but they can also become a performance bottleneck if not used wisely. Complex selectors force the browser to do more work to determine which elements should receive the styles. We highly recommend to study the presentation by Nolan Lawson which covers many important aspects of CSS performance. In the following I provide a list of what I usually try to follow:
Avoid Universal Selectors: Universal selectors (*
Minimize Depth: Deeply nested selectors can be inefficient. Each additional level adds to the time it takes for the browser to evaluate and apply styles. Aim for shallow, concise selectors.
Rightmost Selector: The rightmost selector, also known as the “key selector,” is the most critical part of your query. Browsers filter the DOM based on this, so ensuring it’s as specific as possible can greatly reduce the initial filtering scope.
Avoid Attribute Value Selectors and Certain Pseudo-Classes: Attribute selectors (e.g., [type="text"]:nth-child:not
Leverage Shadow DOM for Style Encapsulation and Optimization: Utilizing Shadow DOM in web components can greatly enhance performance and maintainability. Shadow DOM allows for style encapsulation, meaning styles defined inside a shadow tree won’t affect the main document and vice versa. This scoping reduces the complexity of style calculations and re-calculations when elements update.
Implement CSS Containment: Use the contain
Utilize Content Visibility for Further Optimization: Alongside CSS containment, consider using the content-visibility
Angular’s powerful framework provides an array of tools and features enabling developers to build scalable, reusable, and maintainable components. Understanding how to leverage these features is key to creating extendable components that can adapt to various contexts and requirements. This section delves into several Angular concepts, including ng-contentng-templateng-container
At the heart of creating extendable components is ng-contentselectng-content
@ContentChild@ViewChild@ContentChildng-content@ViewChild
ng-templatengTemplateOutletng-template
ng-container
In Angular, creating dynamic and responsive components often requires direct interaction with the component’s template and the DOM. ViewContainerRefTemplateRefElementRef
ViewContainerRefTemplateRefViewContainerRefElementRef
Retrieving your right Ref: In Angular, when you’re querying for elements or directives using ViewChildContentChild
static: true: Setting static: truengOnInit
read: The readElementRefViewContainerRef
Example: Let’s see how you might use ViewContainerRefTemplateRef
Define your TemplateRef
2. Access and manipulate the template in your component:
In this example, we’re defining a template in the HTML with ng-templateViewChildTemplateRefViewContainerRefcreateEmbeddedViewViewContainerRef
Type checking is an essential aspect of building robust Angular applications, ensuring that your components and templates interact as expected. When you’re working with ng-templateanyngTemplateContextGuard
In this deep dive into Angular’s powerful features for creating extendable components, we’ve explored a range of tools and concepts that are essential for any advanced Angular developer.
Understanding how to create extendable components is just one part of the equation. The next step in ensuring the quality and reliability of your Angular applications is effective testing. In the next part of the series, we’ll delve into testing Angular components (with Storybook).

Intermediate workshop
Master Nx to enforce architecture, speed up your development workflow and improve code quality
Learn more
If Signals were Angular’s “aha!” moment, Zoneless is the “oh wow—this feels snappy” moment. With Angular v21, new apps use zoneless change detection by default. No more zone.js magic under the hood—just explicit, predictable reactivity powered by Signals.

Deploy one Angular app for many clients with unique configs—without breaking SSR or DX. Here’s how to unlock dynamic configuration.

Implement incremental hydration in a real-world Angular app - Basic setup, hydration triggers and important considerations for a seamless integration.

Let's dive deeper into why incremental hydration in Angular matters so much for performance and user experience, focusing on its influence on Largest Contentful Paint (LCP), Interaction to Next Paint (INP), and Cumulative Layout Shift (CLS).

Incremental hydration is a groundbreaking new feature in Angular that heavily impacts critical performance metrics like INP and LCP, while also reducing the effort required to maintain CLS at low levels.

Think of an AST as the secret blueprint, the hidden structure that reveals the true meaning of your code – way more than just the lines you see on the screen. Let's dive in and demystify these ASTs, and I promise you'll see your code in a whole new light.