Announcement Bar
A banner that displays a short site-wide message with an optional action, such as a product update, promotion, or warning.Anatomy
Import and assemble the component:
1import { AnnouncementBar } from '@raystack/apsara'23<AnnouncementBar />
API Reference
Renders a dismissible banner for announcements and alerts.
Prop
Type
Slots
Every rendered part carries a stable data-slot attribute for styling and testing:
| Slot | Element |
|---|---|
announcement-bar | The root <div> element |
announcement-bar-icon | Wrapper around the leading icon (when leadingIcon is set) |
announcement-bar-text | The main text |
announcement-bar-action | The action <button> (when actionLabel or actionIcon is set) |
announcement-bar-action-label | The action button's text label |
announcement-bar-action-icon | Wrapper around the action icon (when actionIcon is set) |
Examples
Variant
Variants convey the tone of the announcement. Default is normal; use error for urgent notices and gradient for promotional messages.
1<Flex direction="column" gap={5} style={{ width: "100%" }}>2 <AnnouncementBar3 variant="normal"4 text="We have introduced a new feature"5 actionLabel="Read More"6 />7 <AnnouncementBar8 variant="error"9 text="Your trial has expired"10 actionLabel="Upgrade"11 />12 <AnnouncementBar13 variant="gradient"14 text="Apsara v1 is now available"15 actionLabel="See what's new"
Accessibility
- The action (when
actionLabeloractionIconis provided) is rendered as a real<button>, so it's focusable, reachable by Tab, and activated by Enter/Space — not as a<Text>with anonClickhandler. - The action button exposes a focus ring via
:focus-visible. - Decorative
leadingIconandactionIconare markedaria-hidden="true"so they don't add noise to screen readers.