如何在MaterialUI / React中全局更改fontWeight

时间:2020-11-10 17:51:05

标签: reactjs material-ui

我想在我的Material UI React项目中全局使用fontweight 300,但是默认设置为400。我只想出了如何在特定组件上覆盖fontWeight(例如下面代码中的h3),所以我寻求帮助为将来将要使用的所有Material UI组件进行全局设置。

overrides: {
            MuiTypography: {
               h3: {
                fontWeight: 300
            }},
            MuiTableCell:{
              root:{
                fontWeight: 200
              }
            },
          },

在下面的代码示例中,我使用createMuiTheme同时更改所有组件的FontFamily和borderRadius,但我不知道如何同时将FontWeight设置为所有Material UI组件。

const theme = createMuiTheme({
  typography: {
    fontFamily: [
      'Sora',
      'sans-serif'
    ].join(','),
  },
  shape:{
    borderRadius:12
  },

1 个答案:

答案 0 :(得分:0)

tru将<p class="content">...med doors. <span class="highlight">loving</span> family. Born in Brewer, ME on August 21, 1934, she was the daughter of Able. Written address greatly get attacks inhabit pursuit our but. Lasted hunted enough an up seeing in lively letter. Had judgment out opinions property the supplied. </p>添加到""

fontWeight