Skip to content

Announcement bar

One short, centred message. Pass messages to step through several with previous and next buttons, and dismissible to let visitors close it for the rest of their session.

  • text, href, linkLabel: a single message and its optional link
  • messages: list of { text, href, linkLabel }; more than one adds prev/next buttons
  • tone: neutral (default), info, success, warning, critical; a tone other than neutral sets the colour and adds an icon
  • surface: light, alternate, brand, dark (default), used by the neutral tone
  • dismissible: shows a close button and remembers the dismissal in sessionStorage
  • id: also the storage key, so give each bar on a site its own id
  • label: accessible name for the landmark (default “Announcement”)

Without JavaScript the first message shows and the buttons stay hidden.

<AnnouncementBar
text="Statement is now in the library."
href="/sections/statement/"
linkLabel="See Statement"
dismissible
/>
messages, surface="alternate"
surface="brand" and surface="light"
Tones