Reputation: 377
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.
Upvotes: 0
Views: 5881
Reputation: 888
<Form requiredMark={false}>
{children}
<Form/>
This will hide the required mark at the form level.
Upvotes: 0
Reputation: 93
You can set requiredMark
prop to false
on the Form component to hide required markers (*).
Upvotes: 4
Reputation: 13141
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;
}
Upvotes: 2