Material-ui: How to import Google Source-Sans font-family in assets, and use it as Globally ?

Created on 2 Jan 2019  路  2Comments  路  Source: mui-org/material-ui

I have downloaded the new font-family, 'Source Sans' in 'assets/font' folder. How to use this through Theming ? Having read custom-theme document, all I see is support to various font-family. But could you provide example, how I can link the font-family of downloaded font through "Theming" ?

question

All 2 comments

Load on the public html and then use like here (in the example we imported Lato)
https://github.com/alexanmtz/material-sense/blob/master/src/App.js

import React, { Component } from 'react';
import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles';
import Routes from './routes'

const theme = createMuiTheme({
  typography: {
    fontFamily: ['"Lato"', 'sans-serif'].join(','),
  },
});

class App extends Component {
  render() {
    return (
      <div>
        <MuiThemeProvider theme={theme}>
          <Routes />
        </MuiThemeProvider>
      </div>
    );
  }
}

export default App;

@alexanmtz Thank you for sharing this solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

finaiized picture finaiized  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

reflog picture reflog  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments