Trying to put asterisk for required using react final form in react

Viewed 1497

I am trying to put asterisk near to the label on a form that is using react final form like as below

           <Field
              name="requestDescription"
              {...(<span style={{ color: 'red' }}>*</span>)}
              component={AntdInputAdapter}
              validate={required}
              type="text"
              placeholder="Enter description..."
            />

but i am not able to see the asterisk on the form, Here is requestDescription mandatory field in the form and i am trying to put the required field indicator as asterisk inside Field near to that name.

Could any one please let me know how can i show asterisk on the form using React-final-form Many thanks in advance.

1 Answers

Field returns meta and input. What you're looking for is a label so that's something you'll have to construct yourself. If your AntdInputAdapter creates that for you, you can pass a required prop to field and check it's value where you display your label.

Related