在AntD中更改form.item标签字体大小

问题描述 投票:4回答:1

我正在使用类似这样的样式组件

const FormItem = styled(Form.Item)`
     font-size: 16px;
`;

使用Form Item这样的东西

    <FormItem label="System Pressurized">
    {getFieldDecorator('systemPressurized')(
      <Select defaultValue="" placeholder="Select Type">
        <Option value="Yiminghe">yiminghe</Option>
      </Select>,
    )}
  </FormItem>

我试过改变AntD的字体大小,但似乎没有锻炼

javascript reactjs antd styled-components typography
1个回答
0
投票

你有两种方式来设置formItem标签的样式

//way one :
//You can override the default css by override below selectors
.form-section .form-group label{
  font-size : 20px
  //YOUR CUSTOM STYLE
}
// way two : 
// You can pass custom component like below : 
  <FormItem label={<p style={YOURCUSTOMSTYLEOBJECT}>System Pressurized</p>}>
    {getFieldDecorator('systemPressurized')(
      <Select defaultValue="" placeholder="Select Type">
        <Option value="Yiminghe">yiminghe</Option>
      </Select>,
    )}
  </FormItem>
© www.soinside.com 2019 - 2024. All rights reserved.