FORMS
FieldError
Standalone validation message with role="alert". For form-level failures and validated groups.
PREVIEW
That address is already in use.
SOURCE
import { FieldError, Field, Input } from '@objectifthunes/whiteboard'
{/* one control: Field already has an error slot */}
<Field label="Email" error={errors.email}><Input {...register('email')} /></Field>
{/* a group, or the whole form: FieldError stands alone */}
<Checkbox label="I accept the terms" checked={terms} onChange={onTerms} />
<FieldError>{submitted && !terms ? 'You must accept the terms.' : null}</FieldError>NOTES
Field already renders its own error, so reach for this only when the message does not belong to one control: a form-level failure, or a group of radios and checkboxes validated together.
Renders nothing when there is no message, so it can sit in the tree unconditionally instead of behind a ternary at every call site.
Carries role="alert", so a message that appears after a failed submit is announced without you having to move focus to it.