Angular Material Overview
Estimated Time: 3 hours | Difficulty: Intermediate | Prerequisites: Components, Forms, Accessibility
Setup
Modern Configuration
Core Components
Buttons & Indicators
Material provides several button variants, each designed for a specific level of visual emphasis. Think of it like typography:mat-button is body text (low emphasis), mat-raised-button is a subheading (medium emphasis), and mat-fab is a headline (high emphasis). Picking the right variant is not just aesthetics — it guides the user’s eye to the most important action on screen.
Form Controls
Material’s form fields are more than styled inputs — they handle the entire lifecycle of a form control: floating labels, hint text, error messages, prefix/suffix icons, and character counts. Themat-form-field wrapper is what ties all of these together. One important design choice: always use appearance="outline" for forms where users enter data (it provides the clearest affordance), and reserve appearance="fill" for filter bars or search inputs where density matters more.
Data Table
MatTable is one of Material’s most powerful components, but also one of its most misunderstood. The key insight: MatTableDataSource is not just a wrapper around an array — it provides built-in filtering, sorting, and pagination that work out of the box when you wire up the corresponding directives. For most CRUD tables, you will never need to write custom filter or sort logic.
Dialogs & Overlays
Dialogs are one of the most over-used patterns in web apps. Before reaching for a dialog, ask: “Could this be inline?” Confirmation for a delete? Inline. Editing a single field? Inline. A multi-step wizard that needs the user’s full attention? That is a dialog. The rule of thumb: dialogs are for actions that need isolation from the rest of the page — they force a decision before the user can continue.CDK Features
Drag and Drop
CDK’s drag-and-drop system handles the physics (momentum, reorder animation), accessibility (keyboard reordering), and cross-container transfers. You provide the data model and the visual template — the CDK handles the rest. The most important concept iscdkDropListGroup: it tells the CDK that multiple drop lists are connected, enabling items to move between them (like a Kanban board).
Virtual Scrolling
Virtual scrolling is the CDK’s answer to the “render 10,000 items without crashing the browser” problem. Instead of creating DOM nodes for every item (which would mean 10,000+ elements in the DOM), it only renders the items visible in the viewport plus a small buffer. As the user scrolls, old items are recycled and new ones are created. The result: a list of 100,000 items feels just as smooth as a list of 20.Overlay & Portal
The CDK Overlay system is what powers every Material popup — dialogs, tooltips, select dropdowns, menus. It solves two hard problems: positioning (the dropdown should appear below the trigger, but flip above if there is not enough room) and z-index management (overlays should stack in creation order without you hardcoding z-index values). If you are building any custom popup component, use the CDK Overlay instead of rolling your own — you will avoid dozens of edge cases around scroll positioning, viewport boundaries, and backdrop handling.Theming
Best Practices
Import Only What You Need
Import individual modules to minimize bundle size
Use CDK for Custom Components
Build on CDK primitives instead of from scratch
Follow a11y Guidelines
Material components are accessible by default - don’t break them
Customize via Theming
Use Sass theming instead of CSS overrides
Next: PWA & Service Workers
Build offline-capable Progressive Web Apps with Angular