Search code examples
reactjsantd

Ant Design Form validation required field


Currently, I am using Ant Design v4, Form to validate the input.

When I set the input as required:true, it renders * in front of the label (title).

My form has 7-8 items, and all of them are required. therefore I want to remove this * from the UI.

How can I do that please.


Solution

  • The * is added via CSS. There's no way to stop ant from adding a .ant-form-item-required class but you could override the CSS

    This should do it:

    .ant-form-item-label>label.ant-form-item-required::before{
       content: none;
    }