Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs-bug(Typography): It isn't clear how to customise Material 3 typography #29214

Open
DzmVasileusky opened this issue Jun 7, 2024 · 9 comments
Labels
area: theming docs This issue is related to documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@DzmVasileusky
Copy link

Documentation Feedback

Material 2 docs were pretty clear about how to customise typography.

@use '@angular/material' as mat;

$my-custom-level: mat.m2-define-typography-level(
  $font-family: Roboto,
  $font-weight: 400,
  $font-size: 1rem,
  $line-height: 1,
  $letter-spacing: normal,
);

$my-custom-typography-config: mat.m2-define-typography-config(
  $headline-1: mat.m2-define-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
  $headline-2: mat.m2-define-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
  $headline-3: mat.m2-define-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
  $headline-4: mat.m2-define-typography-level(34px, 40px, 400),
  $headline-5: mat.m2-define-typography-level(24px, 32px, 400),
  // ...
);

The current page called "Customizing Typography" doesn't have an information on how to customise it at all. It describes the usage only.

Migration guide isn't answering this question as well (https://material.angular.io/guide/material-2-theming#how-to-migrate-an-app-from-material-2-to-material-3).

Affected documentation page

https://material.angular.io/guide/theming#customizing-your-typography

@DzmVasileusky DzmVasileusky added docs This issue is related to documentation needs triage This issue needs to be triaged by the team labels Jun 7, 2024
@amysorto
Copy link
Contributor

amysorto commented Jun 7, 2024

I agree this is an area of improvement, in the meantime the customizable fields are here: https://material.angular.io/guide/typography#configuring-typography. This is how you apply it to your theme: https://material.angular.io/guide/theming#defining-a-theme

@amysorto amysorto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: theming and removed needs triage This issue needs to be triaged by the team labels Jun 7, 2024
@DzmVasileusky
Copy link
Author

@amysorto But what about font-size, line-height, font-weight of specific typography levels?
Why the customisation is so restricted? Can we really only choose font-family and font-weight for bold/medium now?
Does it mean designers can't create their own typography now?

@DzmVasileusky
Copy link
Author

Ok, I could customise it by overriding css vars at least like this:

:root {
    --mat-text-button-with-icon-horizontal-padding: 8px;
    --mdc-text-button-label-text-size: 16px;
}

however it is a partial customisation it would be better if we could customise it more globally

@crisbeto
Copy link
Member

crisbeto commented Jun 7, 2024

Another option could be to enable system variables for the theme and then only change the system variables.

@DzmVasileusky
Copy link
Author

@crisbeto thanks, funny thing I didn't find docs on system variables on the official Angular material website but found it here https://angular-material.dev/articles/angular-material-theming-css-vars

Is it considered as a bad practice? Or are documents just not completed?

@crisbeto
Copy link
Member

crisbeto commented Jun 8, 2024

System variables are supported, we just haven't gotten around to writing a guide for them.

@DzmVasileusky
Copy link
Author

@crisbeto thank you, having a guide for that would be really helpful

@shoff
Copy link

shoff commented Jun 11, 2024

Couldn't agree more the M3 custom schematic documentation is just as bad if not worse. In the age of AI, there's no excuse for such horrible, incomplete and just flat wrong documentation. Either be professional, or stop publishing libraries with crap docs.

@shhdharmen
Copy link

I wrote an article about modifying typescales using CSS variables. You can read it here: https://angular-material.dev/articles/angular-material-18-typography

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: theming docs This issue is related to documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

5 participants