Dumb wrapper that provides label + hint/error + required-marker layout around any form control (`Checkbox`, `Input`, `Textarea`, `Select`, `Toggle`, ...) — the same job AntD's `Form.Item` does. The control itself owns none of this chrome; it just needs an `id` matching `htmlFor`.
Examples of v0.3.4 are shown as code; only the latest version runs live. Open the live examples →
Basic Form Field
1const BasicFormField = () => (2 <FormField label="Email" htmlFor="email">3 <input id="email" type="email" />4 </FormField>5);67render(<BasicFormField />);
Required Form Field
1const RequiredFormField = () => (2 <FormField label="Email" htmlFor="email-required" required>3 <input id="email-required" type="email" />4 </FormField>5);67render(<RequiredFormField />);
Form Field With Hint
1const FormFieldWithHint = () => (2 <FormField label="Email" htmlFor="email-hint" hint="We'll never share this">3 <input id="email-hint" type="email" />4 </FormField>5);67render(<FormFieldWithHint />);
Form Field With Error
1const FormFieldWithError = () => (2 <FormField3 label="Email"4 htmlFor="email-error"5 error="A valid email is required"6 >7 <input id="email-error" type="email" />8 </FormField>9);1011render(<FormFieldWithError />);