- All styled components need to be a child of
ThemeProviderto use the custom theme. This can be nested and you can also access the theme withuseTheme().
import { ThemeProvider } from '@material-ui/core/styles';
import { AVERYCORP_THEME } from './Theme';
function App() {
return (
<ThemeProvider theme={AVERYCORP_THEME}>...</ThemeProvider>
);
}
- To have
Typographyand html elements honor the theme, useCssBaselinebefore those elements or place it within something like aPapersurface.
import { CssBaseline } from '@material-ui/core/CssBaseline';
function MyApp() {
return (
<React.Fragment>
<CssBaseline />
{/* The rest of your application */}
</React.Fragment>
);
}
- Material UI: https://material-ui.com