Tutorials, guides and articles on Angular Material framework.

How to Use Angular Material Theme Colours in Your Components

Angular Material comes with pre-built themes to make getting started easy. Once you've picked a theme such as indigo-pink, you may want to re-use the base colours in your own components for consistency. Instead of creating your own scss variables, I would suggest copying base colours from Angular Material. Let's…

Continue ReadingHow to Use Angular Material Theme Colours in Your Components

How to Make Angular Material Dialog Draggable with cdkDrag

With the Angular Material 7 release, an exciting feature we've been waiting for — drag and drop is available with the component dev kit. In my previous article, I explained how to create a reusable confirm dialog with Angular Material. Today, we’ll learn how to make the dialog draggable. We will…

Continue ReadingHow to Make Angular Material Dialog Draggable with cdkDrag

Select All Option for MatSelect

In this post, you'll learn how to implement select all option for mat-select from Angular Material. Our solution will involve creating a custom component that will be embedded inside a select dropdown. It will also support indeterminate mode of checkbox, meaning our new option will show a different icon based…

Continue ReadingSelect All Option for MatSelect

How to Force Selection in Angular Material Autocomplete

In this post, we'll look at how to validate autocomplete component from Angular Material. Working with reactive forms, we'll write a custom validator to force selection only from the list of options. The autocomplete component is an input with a dropdown of suggested options. It allows the user to type…

Continue ReadingHow to Force Selection in Angular Material Autocomplete

Calendar Component in Angular Material

In this post, you'll learn how to use Angular Material calendar component without date picker input. The calendar component allows date selection in a month view, which could be useful for a wide range of use cases such as booking forms. In addition to displaying a calendar, we will validate…

Continue ReadingCalendar Component in Angular Material

How to Add Angular Material Components Correctly

In this post, I will show you how to add Angular Material components in an Angular application. Importing UI components directly in the app.module increases the size of the module. The root module should be easy to maintain. Importing a button is not a great idea here. For example, consider…

Continue ReadingHow to Add Angular Material Components Correctly