1. Government Frontend Component Guide
  2. Error alert

Component

Error alert

Used at the top of the page, to summarise a unsuccessful user action.

How it looks (preview all)

How to call this component

<%= render "govuk_publishing_components/components/error_alert", {
  message: "Message to alert the user to a unsuccessful action goes here"
} %>

Accessibility acceptance criteria

  • should be focused on page load, to ensure the message is noticed by assistive tech
  • Should have a role of ‘alert’ to communicate that is a important and time sensitive message

Other examples

With message and description (preview)

<%= render "govuk_publishing_components/components/error_alert", {
  message: "Message to alert the user to a unsuccessful action goes here",
  description: "A further description"
} %>

Long example (preview)

<%= render "govuk_publishing_components/components/error_alert", {
  message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut aliquet
    dignissim dui, ac laoreet tortor vulputate nec. Aenean quis turpis
    orci. Proin semper porttitor ipsum, vel maximus justo rutrum vel.
    Morbi volutpat facilisis libero. Donec posuere eget odio non egestas.
    Nullam sed neque quis turpis.
    "
} %>

With data attributes (preview)

<%= render "govuk_publishing_components/components/error_alert", {
  message: "Message to alert the user to a unsuccessful action goes here",
  description: "A further description",
  data_attributes: {
    tracking: "GTM-123AB"
  }
} %>