Search code examples
websassmaterial-componentsmaterial-components-web

Sass - Setting the font family with material web components


I am using material web components in my project and I would like to change the font family. I was going through their documentation and I have tried to do that by setting the variable in my sass file like this:

$mdc-typography-font-family: Comfortaa, sans-serif !default;

But, that didn't work, in the documentation it also says that sass mixin sets the font:

mdc-typography-base 

How can I change the mixin to use a different font-family?


Solution

  • I figured this out by removing !default flag:

    $mdc-typography-font-family: Comfortaa, sans-serif;
    

    Also, don't forget to embed Google Fonts in the head tag:

    <link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">