reactjs - Typography and spacing in material-ui -
i defined raw theme material-ui
in theme.ts
:
import {colors, spacing} 'material-ui/lib/styles/'; import {colormanipulator} 'material-ui/lib/utils/'; import {styles} 'material-ui'; export default <styles.rawtheme> { spacing: spacing, fontfamily: 'roboto, sans-serif', palette: <styles.themepalette> { primary1color: colors.red500, primary2color: colors.red700, primary3color: colors.lightblack, accent1color: colors.orangea200, accent2color: colors.grey100, accent3color: colors.grey500, textcolor: colors.darkblack, alternatetextcolor: colors.white, canvascolor: colors.white, bordercolor: colors.grey300, disabledcolor: colormanipulator.fade(colors.darkblack, 0.3), pickerheadercolor: colors.red500, } };
then in custom react component app.tsx
applied theme:
import * react 'react'; import {appbar, appcanvas} 'material-ui'; import {thememanager, themedecorator} 'material-ui/lib/styles/'; import theme 'theme'; @themedecorator(thememanager.getmuitheme(theme)) export class app extends react.component<{}, {}> { constructor(props) { super(props); } render() { return ( <div> <appbar title={ 'app' } showmenuiconbutton={false}/> <appcanvas> <h1>test</h1> </appcanvas> </div> ); } }
but h1
header not styled has in material design. no roboto
font, smaller size.
does material-ui have built-in styles or else can use style headers according material guidelines , give spacing (margins , padding) elements?
material-ui not include roboto font, it include in project.
quickly verify adding following in <head>
element of html , checking if h1
header styled:
<link href="https://fonts.googleapis.com/css?family=roboto:300,400,500" rel="stylesheet">
if want download roboto font , include in static assets, can here: https://www.fontsquirrel.com/fonts/roboto
Comments
Post a Comment