<govuk-error-message>Enter your full name</govuk-error-message>
Example - overriden visually hidden text
<govuk-error-message visually-hidden-text="Gwall">Rhowch eich enw llawn</govuk-error-message>
<govuk-error-message asp-for="FullName" />
The content is the HTML to use within the generated error message. Content is required if the asp-for
attribute is not specified.
If asp-for
is specified and there are no errors in ModelState
then no output will be generated. If there are multiple errors only the first will be used.
Attribute | Type | Description |
---|---|---|
asp-for |
ModelExpression |
The model expression used to generate the error message. If content is specified this attribute is ignored. See documentation on forms for more information. |
visually-hidden-text |
string |
The visually hidden prefix used before the error message. The default is Error . |