Skip to content

Block 82 of 297

Announcement Bar

A slim full-width notice in four tones, with text labels so meaning never relies on color alone.

Puck key
AnnouncementBarBlock
Export
announcementBarBlock
React component
<AnnouncementBar />
Path
components/puck/announcement-bar-block.tsx
Dependencies
None
License
MIT

About this block

When to use it, how to write for it, and what to change in the code.

What it's for

A one-line, full-width notice that sits at the top of a page or above a header. Pick one of four tones (info, success, warning, urgent) and a soft or bold fill; each tone has its own icon. On phones the icon aligns to the top and the link wraps under the message.

  • Weather closures for pools, parks or facilities
  • Registration or filing deadlines that are coming up soon
  • Service changes such as holiday hours or a road closure
Writing the content
  • Keep the Message to a single sentence. Longer text wraps to several lines on phones and stops reading as a bar.
  • Save Bold emphasis for notices that can't be missed.
  • Link text is optional; leave it blank to hide the link. The Link field accepts a path, full URL, #anchor, mailto: or tel:.
  • If both Message and Link text are empty, the bar renders nothing, so you can leave it on the page between alerts.
Accessibility
  • The tone is spoken before the message as visually hidden text (for example "Warning:"), so its meaning doesn't depend on color or the icon (WCAG 1.4.1).
  • The link is underlined, has a visible focus outline matched to each tone, and has a 44px minimum height.
  • It has no live-region role, so it is read in normal page order rather than announced on load.
Customizing the code
  • All colors, prefixes and icon paths live in the tones map at the top of the file. Edit a tone there to change both soft and bold variants.
  • The content width is max-w-7xl and the text centers from the sm breakpoint up.

Editor fields

What content editors see in the P1 sidebar when they select this block.

  • Toneselect
  • Emphasisradio
  • Messagetextarea
  • Link texttext
  • Linktext