Components
Pre-styled announcement components: Modal, Toast, Banner, Slideout, and Spotlight with built-in close and action buttons
Announcement Components
Pre-built, accessible announcement components styled with Tailwind CSS. Choose from 5 UI variants for different use cases.
Available Components
AnnouncementModal
Centered dialog with overlay - Best for critical updates
AnnouncementSlideout
Side panel - Best for detailed announcements
AnnouncementBanner
Full-width bar - Best for persistent notices
AnnouncementToast
Temporary notification - Best for quick tips
AnnouncementSpotlight
Element highlight - Best for UI changes
Shared Components
All variants use these shared components:
- AnnouncementOverlay - Backdrop overlay for modals and spotlights
- AnnouncementClose - Close button with accessibility
- AnnouncementContent - Content container with title and description
- AnnouncementActions - Action buttons layout
Basic Usage
import {
AnnouncementsProvider,
AnnouncementModal,
AnnouncementBanner,
} from '@tour-kit/announcements';
const announcements = [
{
id: 'welcome',
variant: 'modal',
title: 'Welcome!',
description: 'Thanks for joining.',
},
{
id: 'notice',
variant: 'banner',
title: 'Maintenance scheduled for tonight',
},
];
function App() {
return (
<AnnouncementsProvider announcements={announcements}>
{/* Render component for each announcement */}
<AnnouncementModal id="welcome" />
<AnnouncementBanner id="notice" />
<YourApp />
</AnnouncementsProvider>
);
}Common Props
All components share these props:
id(required) - Announcement identifier matching configclassName- Additional CSS classesasChild- Use Slot pattern for custom elements
Choosing a Variant
| Variant | Use When | Blocking | Auto-Dismiss | Position |
|---|---|---|---|---|
| Modal | Critical updates, requires attention | Yes | No | Center |
| Slideout | Detailed info, less urgent | Partial | No | Side |
| Banner | Persistent notices, non-blocking | No | No | Top/Bottom |
| Toast | Quick tips, success messages | No | Yes | Corner |
| Spotlight | Highlight new UI elements | Partial | No | Target |
Styling
All components use Tailwind CSS with CSS variables for theming:
:root {
--announcement-overlay-bg: rgba(0, 0, 0, 0.5);
--announcement-modal-bg: white;
--announcement-border-radius: 0.5rem;
}See individual component pages for variant-specific styling.
Accessibility
All components are built with accessibility in mind:
- ARIA roles - Proper semantic roles (dialog, banner, status, etc.)
- Focus management - Trap focus in modals, restore on close
- Keyboard support - Escape to close, Tab navigation
- Screen readers - Descriptive labels and live regions
- Reduced motion - Respects
prefers-reduced-motion
Next Steps
Explore each component variant for detailed props and examples: