Skip to main content

This is a new service.

Error message

Read more about the error message component on the Gov.UK Design System website

@using GovUkDesignSystemDotNet

@await Html.GovUkErrorMessage(new ErrorMessageViewModel
{
    HtmlOrText = new HtmlOrText("Enter an email address")
})

Options

Options for ErrorMessageViewModel
Name Type Description
HtmlOrText HtmlOrText Required. HTML or text to use within the error message.
Id string ID attribute to add to the error message <p> tag.
Classes List<string> Classes to add to the error message <p> tag.
Attributes Dictionary<string, string> HTML attributes (for example data attributes) to add to the error message <p> tag.
VisuallyHiddenText string A visually hidden prefix used before the error message. Defaults to "Error".