Components
Error message
When there's a validation error, use an error message to explain what went wrong and how to fix it.
Read the Design System guidance for error message
Import
import { ErrorMessage, ErrorMessageComposite } from 'govuk-react/error-message';Examples
Default
Code
<ErrorMessageComposite>
Enter a National Insurance number in the correct format
</ErrorMessageComposite>API reference
ErrorMessage
When there's a validation error, use an error message to explain what went wrong and how to fix it.
No props of its own. Other props are passed to the element it renders.
ErrorMessageComposite
When there's a validation error, use an error message to explain what went wrong and how to fix it.
| Prop | Type |
|---|---|
visuallyHiddenTextA visually hidden prefix used before the error message. Defaults to | string | false |