Home > Software engineering >  how do I change or override a antd element style
how do I change or override a antd element style

Time:12-08

I need to change a antd form element style i.e label and select, but by changing antd element css (antd-form-item) its changes all the elements associated with it. Adding inline style also doesn't work, also tried creating its own classname but still doesn't work

CodePudding user response:

Just add className to Form.Item component and override it's children css:

  <Form.Item className="my-select" label="Select">
    <Select>
      <Select.Option value="demo">Demo</Select.Option>
    </Select>
  </Form.Item>


.my-select .ant-form-item-label label {
  color: red;
}
  • Related