Components · Form & Input
Form Error
StableAdded v0.0.1
An error message with an alert icon, announced when it appears.
import { FormError } from '@nexub/react';Usage
Use it for
A validation message under a field you lay out yourself
Use something else for
Inside `FormField.Root`: use `FormField.Error`, which wires the ids for you
Errors for a whole form: use the Error Summary pattern
Playground
Props
Enter an email address like name@example.com.
<FormError id="fe-email-error">Enter an email address like name@example.com.</FormError>Examples
Under a field
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | The message: say what went wrong and how to fix it. |
| id | string | — | Point the control at it with aria-describedby so the message is read with the field. |
Accessibility
ARIA roles
alert
Screen reader
Has `role="alert"`, so it is announced when rendered. Render it only when there is an error.
On iOS & Android
Web only
Form Error has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.