Maple · Forms

Form Field

A complete field: label, Input and a helper or error message. Use it in forms instead of a bare Input so every field is labelled and errors say how to fix them.

View in Storybook →

States

Label, hint, helper and error, wired up with aria-describedby.

Required
We’ll only use this to send receipts.
Required
Enter an email like name@example.com
Set by your admin.
<FormField label="Email address" hint="Required" error={err}>
  {({ id, describedBy }) => <Input id={id} aria-describedby={describedBy} error={!!err} />}
</FormField>

Props

PropTypeDefaultDescription
labelstring—Field label.
hintstring—Right-aligned hint, e.g. Required.
helperReactNode—Helper text.
errorReactNode—Error text; replaces helper.
children({ id, describedBy }) => ReactNode—Render the control with these ids.