Skip to content

Commit 429dda8

Browse files
docs(theming): mention mat.theme mixin in M2 to M3 migration section (#32833)
1 parent e594d40 commit 429dda8

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

guides/material-2.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,9 +1090,24 @@ for how to read values from an M3 theme).
10901090

10911091
### Pass a new M3 theme in your global theme styles
10921092

1093-
Create a new M3 theme object using `define-theme` and pass it everywhere you were previously passing
1094-
your M2 theme. All Angular Material mixins that take an M2 theme are compatible with M3 themes as
1095-
well.
1093+
Replace your M2 theme with an M3 theme. For v19 and later, use the `mat.theme`
1094+
mixin as described in the [theming guide][theming]:
1095+
1096+
```scss
1097+
@use '@angular/material' as mat;
1098+
1099+
html {
1100+
@include mat.theme((
1101+
color: mat.$violet-palette,
1102+
typography: Roboto,
1103+
density: 0,
1104+
));
1105+
}
1106+
```
1107+
1108+
Alternatively, you can create a theme object with `mat.define-theme` and pass it
1109+
to individual component theme mixins. This approach is needed for backwards
1110+
compatibility helpers such as `color-variants-backwards-compatibility`.
10961111

10971112
### Update usages of APIs that are not supported for Material 3 themes
10981113

0 commit comments

Comments
 (0)