Skip to content
IndexRequest a UIAboutContact

Inline Alert Banners

Info, success, warning and error banners that can be dismissed, with the right ARIA role for each.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a stack of four inline alert banners for a light interface: info (blue-grey), success (green), warning (amber) and error (red). Each has a small icon, a bold title, one sentence of body text, an optional text action ("Review changes"), and a dismiss X button at the right. Use subtle tinted backgrounds, 1 pixel borders in the same hue, 10 pixel radius, 14 pixel text with good contrast. Accessibility: error uses role alert, others role status, dismiss buttons have aria-label "Dismiss". Dismissing animates height to zero. Include a "Restore all" button. Plain HTML, CSS and JavaScript.

About this pattern

Definition

An inline alert is a message that sits in the page flow near what it concerns. Unlike a toast it stays until it is dismissed or the problem is solved.

Purpose & UX principles

  • Use info for neutral tips, success for completed actions, warning for risks and error for problems that block progress.
  • Pair every colour with an icon and a clear sentence; give a next action when there is one.
  • Errors and warnings that interrupt use role alert; informational ones use role status.

Interaction states

  • Each banner has a dismiss button; Restore brings them back. Errors announce immediately; others politely.

Motion specification

  • Dismiss collapses the banner height over 220ms with fade; restore reverses it.
  • Reduced motion: banners disappear and appear instantly.

Responsive behaviour

  • Banners span the container width; text wraps and the dismiss button stays at the top right.
  • Stack multiple alerts with 8px gaps and cap them at three.

Code

HTML
<div class="bx" id="bx"></div><button id="rs" type="button">Restore all</button>

Related patterns

Toast

↗
ToastFeedback & Notifications

Snackbar

↗
SnackbarFeedback & Notifications

Validation States

↗
Validation StatesInputs & Forms