Skip to content
v0.2.10

ErrorSummary

A linked validation summary that focuses host-owned invalid fields.

Preview
Review the form
Check the highlighted fields.

Use ErrorSummary

ErrorSummary is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
error-summary.tsxTSX
"use client";

import { FloodRoot, ErrorSummary } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <ErrorSummary title="Review the form" errors={[{id:"project",fieldId:"project",message:"Enter a project name."}]} />
    </FloodRoot>
  );
}

Design notes

  • The host supplies errors; ErrorSummary does not infer validation or submit a form. Each entry links to an exact field ID.
  • Normal activation focuses the target while modifier navigation remains native. onSelect can cancel the action before focus moves.
  • announcement defaults to off. autoFocus opts into focus on appearance, not on every error update, and suppresses duplicate live announcements. Empty errors render nothing. Introduced in 0.2.7.

API reference

PropValuesDefault
titlestringRequired
errorsreadonly ErrorSummaryItem[]Required
descriptionReactNode—
announcement"off" | "polite" | "assertive""off"
autoFocusbooleanfalse
onSelect(error: ErrorSummaryItem, event: ReactMouseEvent<HTMLAnchorElement>) => void—
Native HTML propsOmit<HTMLAttributes<HTMLDivElement>, "children" | "title" | "onSelect" | "role" | "aria-live">Forwarded
View TypeScript source