Alerts

The alert pattern is used to convey important information to users with two different levels of importance.

Alert box

This should be used to announce information that takes precedence over all other page content. The inclusion of role="alert" will assist screen readers in announcing this content ahead of other information, so it should be used with caution.

Rules for alert boxes

  • There should only be one alert box on a page at a time.
  • Must not appear before the header, category header, main navigation, breadcrumbs or hero banner patterns.
  • Wrap text with a div with a class of alert plus one of the four option classes:
    • alert--success
    • alert--info
    • alert--warning
    • alert--danger
  • Use the different option classes to convey different types of message.
  • Must have a heading introducing the type of message.

Callout

This should be used to promote inline content that is of greater importance than the surrounding content. This can be used as a visually more prominent option over using bold text, but where the information is not sufficiently important to use an alert box.

Rules for callouts

  • Using too many callouts on a page will lower the visual impact of each and reduce their effectiveness.
  • Must not appear before the header, category header, main navigation, breadcrumbs or hero banner patterns.
  • Wrap text with a div with a class of callout plus one of the four option classes:
    • callout--success
    • callout--info
    • callout--warning
    • callout--danger
  • Use the different option classes to convey different types of message.
  • Must have a heading introducing the type of message.

Options available


Alert (Success)

Use the class alert--success for a success alert box. This alert box indicates a successful or positive action, such as successfully submitting a form.

Example
Code




Alert (Info)

Use the class alert--info for an info alert box. This alert box indicates neutral information or a neutral action, such as a recommendation or an update.

Example
Code




Alert (Warning)

Use the class alert--warning for a warning alert box. This alert box indicates a warning that might need attention or carries a time limit, such as impending application deadlines.

Example
Code




Alert (Danger)

Use the class alert--danger for a danger alert box. This alert box indicates a dangerous or potentially negative action such as closures or expired deadlines.

Example
Code




Callout (Success)

Use the class callout--success for a success callout box. This callout box indicates a successful or positive action, such as successfully submitting a form.

Example

Thank you!

Thank you for submitting your details. If you have any questions please email example@st-andrews.ac.uk.

Code

Thank you!

Thank you for submitting your details. If you have any questions please email example@st-andrews.ac.uk.


Callout (Info)

Use the class callout--info for an info callout box. This callout box indicates neutral information or a neutral action, such as a recommendation or an update.

Example

Did you know?

University of St Andrews was founded over 600 years ago? Find out more about the history of St Andrews.

Code

Did you know?

University of St Andrews was founded over 600 years ago? Find out more about the history of St Andrews.


Callout (Warning)

Use the class callout--warning for a warning callout box. This callout box indicates a warning that might need attention or carries a time limit, such as impending application deadlines.

Example

Warning!

The deadline for submissions is the end of Semester 2. If you need help, please email example@st-andrews.ac.uk.

Code

Warning!

The deadline for submissions is the end of Semester 2. If you need help, please email example@st-andrews.ac.uk.


Callout (Danger)

Use the class callout--danger for a danger callout box. This callout box indicates a dangerous or potentially negative action such as closures or expired deadlines.

Example

Submissions have ended

The deadline for submissions has passed. If you need help please email example@st-andrews.ac.uk.

Code

Submissions have ended

The deadline for submissions has passed. If you need help please email example@st-andrews.ac.uk.