SoodAnkita
GuacamoleAnkita
Austin, Texas
ankitasood.bsky.socialWebVibesOnlyIn Angular Material v15, many of the components were refactored to be based on the official Material Design Components for Web (MDC)
$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette,
A200, A100, A400);
$my-warn: mat.m2-define-palette(mat.$m2-red-palette);
$my-theme: mat.m2-define-light-theme((
color: (
primary: $my-primary,
accent: $my-accent,
warn: $my-warn,
),
typography: mat.m2-define-typography-config(),
density: 0,
));No automated migration.
Mixins that take an M2 theme are compatible with M3 themes.
To maintain the behavior of color="primary", color="accent", or color="warn", enable the backwards compatibility styles.
To ease migration typography-hierarchy mixin can emit both old(M2) and new(M3) class names.
Enable by passing $back-compat:true to the mixin.
@include mat.color-variants-backwards-compatibility($theme);
@include mat.typography-hierarchy($theme, $back-compat: true);
Mixin Usage: M3 requires -theme, -color, -typography, -density, and -base mixins to be wrapped in a selector
(e.g., html{...}).
Component Color Variants: Color mixins instead of input.
<section class="tertiary-btn">
<button mat-button>Print</button>
<button mat-button>Share</button>
<section>
<button mat-button class="tertiary-btn">Download</button>
.tertiary-btn {
@include mat.button($theme, $color-variant: tertiary);
}
Unsupported Properties:
backgroundColor for <mat-tab-group> is not supported.appearance="legacy" for <mat-button-toggle> is not supported.Typography Mixins: all-component-typographies no longer emits typography-hierarchy in M3. Explicitly call typography-hierarchy mixin to include these styles.
Typography Classes: typography-hierarchy mixin outputs new CSS class names for typescale levels. Update any M2-based class names accordingly.
Diagram of all Material 3 color roles
Diagram of all Material 2 color roles
Granular Customization: Fine-tune themes with CSS variables.
Simplified Styling: No extra selector specificity.
Flexible API: Applying color variants to components via CSS.
Theming Custom Components: New Sass APIs let you access M3 theme properties for custom component creation.
$theme: mat.define-theme((
color: (
theme-type: dark,
primary: mat.$violet-palette,
),
typography: (
brand-family: 'Comic Sans',
bold-weight: 900
),
density: (
scale: -1
)
));
ng generate @angular/material:m3-theme
$theme: mat.define-theme((
color: (
theme-type: dark,
primary: mat.$rose-palette,
secondary: mat.$blue-palette,
),
typography: (
brand-family: 'Comic Sans',
bold-weight: 900
),
density: (
scale: -1
)
));
$theme: mat.define-theme((
color: (
theme-type: dark,
primary: mat.$rose-palette,
),
typography: (
brand-family: 'Comic Sans',
bold-weight: 900
),
density: (
scale: -1
)
));
$theme: mat.define-theme((
color: (
theme-type: dark,
primary: mat.$rose-palette,
),
typography: (
brand-family: 'Comic Sans',
bold-weight: 900
),
density: (
scale: -1
)
));
| Name | Description |
|---|---|
address-form |
Form group consisting: Form fields, Radio controls, Buttons |
| navigation | Toolbar & a responsive side nav based on Material breakpoints |
| dashboard | Dynamic list of cards & menus aligned in a grid layout |
| table | Pre-configured <table> with a datasource for sorting & pagination |
| tree |
<mat-tree> component to visualize a nested folder structure |
| drag-drop (CDK) | component that uses the CDK drag and drop directives |
ng generate @angular/material:address-form <component-name>
ng generate @angular/material:navigation <component-name>
ng generate @angular/material:dashboard <component-name>ng generate @angular/material:table <component-name>ng generate @angular/material:tree <component-name>
ng generate @angular/cdk:drag-drop <component-name>