X Enterprises
nuxt-x-affiliate

Announcement Bar

Dismissible strip above the header for a promo, deal, or notice, with localStorage persistence.

Announcement Bar

A dismissible strip above the header. Dismissal persists in localStorage under storageKey.

Give each distinct announcement its own key. Reusing one key means a visitor who dismissed last month's promo never sees this month's.

Components

<XAFAnnouncementBar />

<XAFAnnouncementBar
  badge="New"
  message="Spring buying guides are live."
  icon="i-lucide-sparkles"
  link="/best"
  link-text="See the guides"
  storage-key="spring-2026-guides"
/>
<XAFSiteHeader />

Props

PropTypeDefaultDescription
messagestring''Main text
badgestring''Bold label before the message
iconstring''Iconify name
linkstring''Trailing call-to-action destination
linkTextstring'Learn more'Trailing link label
variant'primary' | 'neutral' | 'success' | 'warning' | 'error''primary'Colour
dismissiblebooleantrueShow the close button
storageKeystring'xaf-announcement-dismissed'localStorage key holding the dismissed flag

Events

EventPayloadDescription
dismiss—Fired when the visitor closes the bar

Tips

  • The bar starts hidden and reveals after the storage check on mount. localStorage is not readable during SSR, so rendering it visible first would flash a bar the visitor already dismissed on every page load.

AI Context

component: XAFAnnouncementBar
package: "@xenterprises/nuxt-x-affiliate"
use-when: Dismissible promo or notice strip above the header
Copyright © 2026