AnnouncementBanner
A persistent, page-level banner for service-wide messages — scheduled maintenance, public-interest news, regulatory notices — that every user should see while the message is active.
The component renders a <div role="region"> so the banner is a labeled landmark in the page outline, named by the required label prop. Two optional behaviours layer on top:
dismissibleadds a close<button>so users can hide a non-critical banner once they have read it; the consumer decides whether the dismissal is remembered (cookie, local storage, server flag).livepromotes the region toaria-live="polite"so screen readers announce content changes (e.g. updated maintenance ETA) without interrupting the user.
Reach for AnnouncementBanner when the message is broad and persistent. Use Alert for status tied to a specific section or action, Notification / Toast for transient confirmations, and PhaseBanner specifically for alpha/beta service phase messaging.
Implementation Notes
- Renders a
<div role="region">with anaria-labelso screen readers announce the banner as a labeled landmark - Optional
dismissiblemode renders a close<button>that hides the banner when activated - Accepts
childrenslot for the announcement content (text, links, icons composed by the consumer) - When
liveis true, the region also getsaria-live="polite"so dynamic content changes are announced - Spreads
restPropsonto the root<div>for consumer customization
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string (required) | — | Accessible region label |
live | boolean | false | Whether the region announces dynamic changes via aria-live="polite" |
dismissible | boolean | false | Whether to render a dismiss button |
dismissLabel | string | "Dismiss" | Accessible label for the dismiss button |
onDismiss | callback | — | Fired when the user dismisses the banner |
children | slot (required) | — | Banner content |
...restProps | HTML attributes | — | Spread onto the root <div> |
Usage
<AnnouncementBanner label="Service announcement" dismissible>
<p>Maintenance is scheduled for Sunday between 2am and 4am.</p>
</AnnouncementBanner>
Keyboard Interactions
- Tab moves focus to the dismiss button when present
- Enter or Space activates the dismiss button (native browser behaviour)
ARIA
role="region"makes the banner a labeled landmarkaria-label(fromlabel) names the regionaria-live="polite"(whenlive=true) announces content changes without interrupting the user- Dismiss button has
aria-labelfor the close action
When to Use
- Communicating service-wide messages such as scheduled maintenance, important news, or new feature launches
- Surfacing time-sensitive information that all users should see
When Not to Use
- Use
Alertfor in-flow status messages tied to a specific action or section - Use
Notificationfor transient toast-style messages - Use
PhaseBannerto indicate the development phase of a service - Use
MedicalBannerfor clinical safety information
Headless
This headless component renders semantic HTML with appropriate ARIA wiring. The consumer provides all visual styling — no CSS, animations, or layout assumptions are baked in.
Styles
The component renders with .announcement-banner as the root class. No default styles are included.
Related components
banner— generic top-of-page bannerphase-banner— service development phase indicatoralert— in-flow status messagenotification— transient toast