Dismissal key. Required with the message to render the bar.
Announcement Bar
1 min readStableIntermediate
A site-wide dismissible announcement bar can be activated by setting environment variables. The bar renders only when both the ID and message are set, and dismissals persist per announcement ID via localStorage.
Quick Start
Enable the bar with an ID and message.
Bash
Bash
NEXT_PUBLIC_ANNOUNCEMENT_ID=launch
NEXT_PUBLIC_ANNOUNCEMENT_MESSAGE="Welcome to our new docs"Adding Options
Add a link. The link renders only when both the href and label are set.
Bash
Bash
NEXT_PUBLIC_ANNOUNCEMENT_ID=launch
NEXT_PUBLIC_ANNOUNCEMENT_MESSAGE="Welcome to our new docs"
NEXT_PUBLIC_ANNOUNCEMENT_HREF=/getting-started/introduction
NEXT_PUBLIC_ANNOUNCEMENT_LINK_LABEL="Get started"Advanced
Set NEXT_PUBLIC_ANNOUNCEMENT_DISMISSIBLE=false to hide the close button. Changing the ID re-shows the bar to every reader because dismissal is keyed to the ID.
Options
NEXT_PUBLIC_ANNOUNCEMENT_IDenvNEXT_PUBLIC_ANNOUNCEMENT_MESSAGEenvBanner message. Required with the ID to render the bar.
NEXT_PUBLIC_ANNOUNCEMENT_HREFenvOptional link target. Internal paths and external URLs are accepted.
NEXT_PUBLIC_ANNOUNCEMENT_LINK_LABELenvOptional link text. The link renders only when both the href and label are set.
NEXT_PUBLIC_ANNOUNCEMENT_DISMISSIBLEenvDefault: trueSet to false to hide the close button.
Related pages
Was this page helpful?