bug(Theming Angular Material): Custom typography not applied to standard typography levels in mat.core-theme() or all-component-themes()
See original GitHub issueIs this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Tried to change the font-family so that e.g. body-1 everywhere has font family Arial. But it only changed the font-family in mat components, not outside in normal divs.
$my-typography: mat.define-typography-config(
$font-family: 'Arial',
);
$my-theme: mat.define-light-theme((
typography: $my-typography,
color: (
primary: $dicey-primary,
accent: $dicey-accent,
warn: $dicey-warn,
))
);
@include mat.all-component-themes($my-theme);
Similar problem was reported here, but not solved: https://github.com/angular/components/issues/23683#issue-1015421891
It works when I do it with all-component-typographies:
$my-typography: mat.define-typography-config(
$font-family: 'Arial',
);
@include mat.all-component-typographies($my-typography);
Reproduction
Steps to reproduce:
- Add custom theme with typography
- See if body tag font-family changes
Expected Behavior
Bodys font family changes to custom font family
Actual Behavior
The body font family is standard Roboto
Environment
- Angular: 13.1.2
- CDK/Material: 13.1.1
- Browser(s): Firefox
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
angular material - custom typography does not apply
I call the default class that comes with this component and invoking the mat.typography-level mixin I try to configure it. .mat-toolbar{ @ ...
Read more >Customizing Typography - Angular Material
Typography is a way of arranging type to make text legible, readable, and appealing when displayed. Angular Material's theming system supports customizing the ......
Read more >Custom Theme for Angular Material Components Series: Part 2
First, we created an Angular Project with a custom theme, a dark theme, custom typography for headings and couple of helper modules (...
Read more >@angular/material | Yarn - Package Manager
The Angular team builds and maintains both common UI components and tools to help you build your own custom components. The team maintains...
Read more >Customizing the Typography Theme for a Packaged Angular ...
In Creating a Packaged and Themeable Angular Material Component we created a self contained installable Angular component that was also themeable.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
mat-core
does not appear to allow any parameters on v15:Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Only 0 arguments allowed, but 1 was passed. ┌──> src/styles.scss 33│ @include mat.core($my-theme);
Yes, that are all nice workarounds. I already mentioned that it works with all-component-typographies. But the bug is, that it is not working with all-component-themes. And this has to be fixed. Please.
I just tried out the kids-theme example on the website , and this is not working either.