Error alert
Used at the top of the page, to summarise a unsuccessful user action.
How it looks (preview) (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)
Message to alert the user to a unsuccessful action goes here
A further description
<%= 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)
The example shown applies a tracking attribute specifically for use by Google Tag Manager in Content Publisher.
Other data attributes can also be applied as required. Note that the component does not include built in tracking. If this is required consider using the GA4 link tracker.
Message to alert the user to a unsuccessful action goes here
A further description
<%= 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"
}
} %>
With specified id attribute (preview)
<%= render "govuk_publishing_components/components/error_alert", {
id: "test-id",
message: "Message to alert the user to a unsuccessful action goes here"
} %>