# ErrorSummary

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

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"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

| Prop | Values | Default |
| --- | --- | --- |
| `title` | `string` | `Required` |
| `errors` | `readonly ErrorSummaryItem[]` | `Required` |
| `description` | `ReactNode` | `—` |
| `announcement` | `"off" \| "polite" \| "assertive"` | `"off"` |
| `autoFocus` | `boolean` | `false` |
| `onSelect` | `(error: ErrorSummaryItem, event: ReactMouseEvent<HTMLAnchorElement>) => void` | `—` |
| `Native HTML props` | `Omit<HTMLAttributes<HTMLDivElement>, "children" \| "title" \| "onSelect" \| "role" \| "aria-live">` | `Forwarded` |
