Alert
<gcds-alert>
-
GitHub -
Figma
Alert component preview
On this page
Coding and accessibility for alerts
Define the alert role
alert-role attribute to categorize the alert as info, warning, danger or success. This choice determines the visual styling of the alert and communicates the urgency or importance of the message to people. Specify the alert title
heading attribute to create a clear and informative title for the alert. Make sure the title conveys the message’s purpose. Examples
In this section
Essential attributes
heading
heading to define the title of the alert. <gcds-alert
heading="You already have an application in progress"
></gcds-alert> Optional attributes
alert-role
alert-role to set the style of the alert. Choose from: infosuccesswarningdanger
<gcds-alert
heading="Your changes have been saved"
alert-role="success"
></gcds-alert> container
container to define the container width for the alert content. <gcds-alert
heading="You already have an application in progress"
container="sm"
></gcds-alert> hide-close-btn
hide-close-btn to true to hide the dismiss button. By default, it’s set to false, which displays the dismiss button. <gcds-alert
heading="You already have an application in progress"
hide-close-btn="true"
></gcds-alert> hide-role-icon
hide-role-icon to true to hide the alert’s role icon. By default, it’s set to false, which displays the icon. <gcds-alert
heading="You already have an application in progress"
hide-role-icon="true"
></gcds-alert> is-fixed
is-fixed to true to fix the alert’s position at the top. By default, it’s set to false. <gcds-alert
heading="You already have an application in progress"
is-fixed="true"
></gcds-alert> Slots
default
default slot to add any type of content to the alert’s message. You can add things like text, links, or buttons. <gcds-alert heading="You already have an application in progress">
<p>Message.</p>
</gcds-alert> - Explore by choosing different code values to generate the instance you want.
- Get the code and pull it into your environment.
- Add any copy you need to the component (like text for a label).
Message.