Notification component
Introduction
The Notification component provides a way to display important messages to users with different severity levels and proper ARIA attributes for accessibility. It supports various types of notifications and can be enhanced with icons.
When to use
- Status updates
- Success messages
- Warning alerts
- Error messages
- Information notices
- System feedback
- Form submission results
- Toast notifications
Usage
Props
Prop | Type | Default | Description |
---|---|---|---|
type | 'info' | 'success' | 'warning' | 'error' | 'default' | 'default' | Sets the notification style and context |
role | 'none' | 'alert' | 'log' | 'marquee' | 'status' | 'timer' | 'region' | 'none' | ARIA role for the notification |
ariaLive | 'off' | 'polite' | 'assertive' | 'off' | Controls how screen readers announce updates |
Accessibility features
- Different colors and icons for different notification types
- Proper ARIA roles for dynamic content
- High contrast colors meeting WCAG guidelines
- Contextual information through clear labeling
- Screen reader announcements for dynamic notifications
Styling
Interactive example
Message: This is a notification!
Info: This is a notification of type info.
Success: This is a notification of type success.
Warning: This is a notification of type warning.
Error: This is a notification of type error.