Skip to content

FormErrorSummary

Submit-time error list for forms of three or more fields (WCAG 3.3.1). A danger Callout whose heading takes focus after a failed submit, with a link per invalid field that focuses it.

// Plain markup
import { FormErrorSummary } from "@shavin/ui";

After a failed submit

Press Save with the form empty: focus moves to the summary heading, each item links to its field, and every field keeps its own error.

Component Source
<form noValidate onSubmit={onSubmit}>
  {errors.length > 0 && <FormErrorSummary key={attempt} errors={errors} />}
  <TextField id="email" label="Email" errorMessage={fieldErrors.email} />
  <FormField id="bio" label="Bio" error={fieldErrors.bio}><TextArea /></FormField>
  <Button type="submit" loading={saving}>Save profile</Button>
</form>

Accessibility

  • The summary is a group named by its heading, not an alert: the focus move to the heading is the one announcement.
  • Per-field error announcements are silenced for that render, so nothing is read twice.
  • Remount it on each failed submit (a new key) so focus moves again.

Props

PropTypeDefaultDescription
errors*FormErrorSummaryItem[]—One entry per invalid field; each becomes a link that focuses that field.
titlestringFixHeading. Default "Fix 1 field to continue" / "Fix N fields to continue".
focusOnMountbooleantrueMove focus to the heading when the summary appears after a failed submit (WCAG 3.3.1). Default true.
titleAs"h2" | "h3" | "h4"h2Heading element. Default h2.

* required

Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font