115 Components
Announcement Banner
NavigationSlim, animated top banner that announces product releases, features, or offers with Snappy spring physics, smooth rotation, and collapse animations.
NewBannerDismissibleSpring
Installation
Install directly into your project using the shadcn CLI or copy the source code manually.
Requires:framer-motionlucide-reactclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/announcement-banner.json"
Props
TypeScript props supported by <AnnouncementBanner />.
| Prop | Type | Default | Description |
|---|---|---|---|
| messagesrequired | AnnouncementMessage[] | — | Array of announcement messages. A single item displays statically; multiple items rotate automatically. |
| variant | "default" | "accent" | "inverted" | "glass" | "fade" | "outline" | "highlight" | "default" | Visual style variant: subtle neutral ('default'), teal accent ('accent'), high contrast ('inverted'), frosted ('glass'), horizontal gradient ('fade'), minimal border ('outline'), or warning yellow ('highlight'). |
| dismissible | boolean | true | Whether to display the close button and enable banner dismissal. |
| storageKey | string | "boseui-announcement" | Local storage key namespace. Dismissal tracks messages[0].id so updated announcements reappear. |
| rotateInterval | number | 5000 | Interval in milliseconds between rotating messages when multiple messages are supplied. |
| sticky | boolean | false | If true, pins the banner to the top of the viewport during scrolling. |
| stiffness | number | 380 | Spring stiffness coefficient matching the Snappy preset. |
| damping | number | 24 | Spring damping coefficient controlling oscillation decay matching the Snappy preset. |
| onDismiss | () => void | undefined | Callback invoked when the user dismisses the banner. |
| background | React.ReactNode | undefined | Optional background element (e.g. FlickeringGrid or canvas texture). |
| className | string | undefined | Additional Tailwind classes applied to the outer container. |
Key Features
- Snappy spring physics preset (stiffness 380, damping 24) powering enter, rotation, and collapse transitions.
- Zero-jump collapsing dismiss animation that smoothly slides the entire page content up.
- Auto-rotating message sequence that automatically pauses on hover, keyboard focus, and background tabs.
- SSR and hydration safe localStorage persistence with message-id invalidation.
- Dynamic --announcement-height CSS variable synchronization for sticky headers.
- Accessible keyboard navigation with visible focus rings and WCAG AA contrast across 3 color variants.
Keyboard & Accessibility
- Landmark semantics with role='region' and aria-label='Announcement'.
- Rotating text container uses aria-live='off' to prevent interrupting screen readers.
- Accessible dismiss button with minimum hit target, keyboard focus states, and aria-label.
- Full reduced-motion compatibility disabling slide animations and auto-rotation.