繁体   English   中英

更改标签素材的字体大小

[英]Change the font size of a label material-ui

我只是想不通这个家伙。 我想用我的文本字段更改标签的字体大小。 到目前为止,我只能更改输入的字体大小,而不能更改标签。

文本域:

<TextField
 className={classes.TextField}
 id="input-with-icon-textfield"
 label="Zoeken"
 InputProps={{
 startAdornment: (
                  <InputAdornment position="start">
                         <Search />
                  </InputAdornment>
                                  ),
                 }}
 onChange={(e) => {this.setTextFilter(e.target.value);}}
 />

在此处输入图片说明

添加了一张图片,以便您可以看到标签的意思。

我最终在我的主要mui主题中添加了一些代码。

const theme = createMuiTheme({
palette: {
  primary: {
    main: '#39870c',
    ligth: '#6cb842',
    dark: '#005900'
  },
  secondary: {
    light: '#01689b',
    main: '#0044ff',
    contrastText: '#ffcc00',
  },
},
overrides: {
  MuiInputLabel: { 
    root: { 
      color:'black',
      fontSize: 13, 
    },
  },
}


}); 

使用覆盖,我基本上可以更改任何内容。 我希望这对以后的人有所帮助,因为这真的很烦人。

此处的另一个选项:insted替代您可以用作标签props内的Typography组件。 看例子

<TextField 
  label={
    <Typography variant="headline" component="h3"> Zoeken </Typography>
  } ..../>

希望这会帮助某人。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM