Rime

ErrorSummary

The list of form errors at the top of a form, focused on submit, each linking to its field.

ErrorSummary follows the GOV.UK pattern: after a failed submit it takes focus, lists every error as a link, and each link moves focus to the field.

Installation

npx shadcn@latest add KezLahd/rime/error-summary

Also installs: base, icon.

Usage

import { ErrorSummary } from "@/components/ui";

<ErrorSummary errors={[{ id: "email", message: "Enter an email address" }]} focusKey={submitCount} />

Examples

Default

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

ErrorSummary

ErrorSummary props
PropTypeDefaultDescription
errorsRequiredReadonlyArray<FormError>
titlestring
focusKeynumber | stringChange this (e.g. a submit counter) to move focus to the summary again. Focus moves on mount and whenever it changes.
classNamestring

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

This component has no tokens of its own; it reads the system tokens below.

System tokens it reads

ErrorSummary system tokens
TokenDefaultLive value
--danger-filltokens.css…
--danger-gradienttokens.css…
--danger-inktokens.css…
--danger-linetokens.css…
--durtokens.css…
--easetokens.css…
--focus-colortokens.css…
--focus-ringtokens.css…
--glow-dangertokens.css…
--ink-inversetokens.css…
--ink-mutedtokens.css…
--ink-secondarytokens.css…
--line-softtokens.css…
--r-2xstokens.css…
--r-mdtokens.css…
--r-smtokens.css…
--rgb-dangertokens.css…
--shadow-lifttokens.css…
--shadow-specular-darktokens.css…
--surface-solidtokens.css…
--text-captiontokens.css…
--text-card-titletokens.css…
--text-microtokens.css…
--text-smalltokens.css…

Accessibility

  • role="alert" and focus moves to the summary when focusKey changes, so it is announced once per submit.

Do and don't

Do

  • Use the same message text here and under the field.

Don't

  • Don't show it before the first submit.

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open error-summary.md