Skip to content
Moodle Design Systemby Didactika
Moodle 5.3 LTS
v0.1
EN
Bootstrap components
Didactika theme v0.1

Alerts

A message inside the page that tells the user what happened or what to know, with a colour that says how important it is.

An alert is a message in the flow of the page: a result, a warning or a tip. It stays until the situation changes or the user dismisses it. For something temporary, use a toast.

When to use it

Use it

  • Say what happened and what to do, in one or two sentences.
  • Pick the colour by meaning: success, info, warning, danger.
  • An icon of Moodle that matches the meaning, and a heading only when the message needs one.
  • A link or button for the next step.

Don't

  • Use colour as the only signal: the text and the icon say it too.
  • Stack several alerts; merge them into one.
  • Use danger for what is not an error or a risk.
  • Auto-hide a message the user needs to read.

Anatomy

A box (alert and a colour) with optional icon, heading (alert-heading), text, links (alert-link) and a close button when it is dismissible.

Variants and states

Colours

Styles

The default is a soft tint of the colour with an accent bar on the left. Didactika adds three more for the other needs: flat (no bar, for dense places), outline (the lightest) and solid (the strongest, for the one message that must not be missed).

Styles
Soft with accent (the default). The colour is a tint and a bar on the left.
Soft, flat. The same without the bar, for dense places.
Outline. For a message that must not weigh on the page.
Solid. For the one message the user must not miss.
Flat info. Grades are published on Monday.

Icon, heading and actions

An icon goes in a tile (dd-tile), which takes the colour of the alert. A heading names the message, the text says what to do, and the actions are buttons of the same colour.

Icon, heading and actions
Backup finished

The course was saved. You can download the file for 7 days.

New participants get an email when they are enrolled.
Settings

Dismissible

Dismissible
Profile saved.

Combinations

Combination Use it for
Colour × meaning Success for what finished, info for what to know, warning for what to check, danger for what failed. Primary, secondary, light and dark are neutral notices.
Style × weight Soft by default; flat in dense places; outline when it must not weigh on the page; solid for the one message that cannot be missed.
Icon + heading + actions A tile with an icon, a heading, one or two sentences and the next step as a button or link.
Alert × dismissible Only if the message does not come back with the page; close button at the right.

What Didactika changes and why

What we changed Why it helps
A tint, a line and a text colour derived from the role Every role reads at 4.5:1 or more, and the message is told by the words, the icon and the bar, not only by the colour.
Light, secondary and dark are three clear steps Light is the quietest, dark is the strongest, secondary sits between: they never swap places.
The icon lives in a tile of the alert’s colour The eye lands on the tile first and knows the kind of message before reading it.
The accent bar on the left It marks the message without a heavy border, and it is the part of the alert that stays when the tint is lost in a dark theme.

Classes

Class What it does
alert Base
alert-primary, alert-secondary, alert-success, alert-danger, alert-warning, alert-info, alert-light, alert-dark Colour by meaning
alert-heading, alert-link Heading and link that match the colour
alert-dismissible, btn-closeclose Lets the user close it
fade show Animates when it appears and when it closes
alert-flat, alert-outline, alert-solid Styles of the alert: no bar, outline only and filled (Didactika)
dd-tile The tile that holds an icon; it takes the colour of the alert around it (Didactika)

In this version

Bootstrap 5.3 keeps its colours in CSS variables (--bs-*), so a theme recolours the component with one variable.

Bootstrap 4.6 compiles its colours into the classes, so a theme recolours the component by rebuilding its stylesheet.

Bootstrap 4.6 compiles its colours into the classes, so a theme recolours the component by rebuilding its stylesheet.

Accessibility

  • role="alert" for something that must be read now; role="status" for something polite.
  • The close button has an aria-label.
  • Contrast of the text against the tint is at least 4.5:1.
  • Never rely on colour alone: use words and an icon.