Alert
Display important messages and notifications to users with various styles and colors.
import { Alert } from "@ninna-ui/feedback"pnpm add @ninna-ui/feedbackRequires @ninna-ui/core (auto-installed) + CSS setup.
Usage
Import and use the Alert component in your application.
import { Alert } from "@ninna-ui/feedback";
export default function Example() { return ( <Alert color="success" title="Success!" description="Your changes have been saved." /> );}Solid
Alerts with solid background colors for high emphasis.
Neutral
This is a neutral solid alert message.
Primary
This is a primary solid alert message.
Secondary
This is a secondary solid alert message.
Accent
This is an accent solid alert message.
Info
A new version is available for download.
Success
Your changes have been saved successfully.
Warning
Please review your information before continuing.
Danger
There was an error processing your request.
Soft
Alerts with light tinted backgrounds for subtle emphasis.
Neutral
This is a neutral soft alert message.
Primary
This is a primary soft alert message.
Secondary
This is a secondary soft alert message.
Accent
This is an accent soft alert message.
Info
A new version is available for download.
Success
Your changes have been saved successfully.
Warning
Please review your information before continuing.
Danger
There was an error processing your request.
Outline
Alerts with transparent background and colored border.
Neutral
This is a neutral outline alert message.
Primary
This is a primary outline alert message.
Secondary
This is a secondary outline alert message.
Accent
This is an accent outline alert message.
Info
A new version is available for download.
Success
Your changes have been saved successfully.
Warning
Please review your information before continuing.
Danger
There was an error processing your request.
Dismissible
Alerts that can be dismissed by the user.
Neutral Alert
Click the X button to dismiss this alert.
Success!
Your profile has been updated successfully.
Error
Failed to save changes. Please try again.
Warning
Your session will expire in 5 minutes.
With Icon
Alerts with custom icons or without icons.
Custom Icon
This alert uses a custom Bell icon.
Security Update
Your account security has been enhanced.
Performance Alert
System performance is running at optimal levels.
Important Notice
Please review your account settings.
Featured Content
Check out our new featured articles.
No Icon
This alert has no icon displayed.
With Action
Alerts with action buttons for user interaction.
New Update Available
A new version of the application is ready to install.
Session Expiring
Your session will expire in 5 minutes. Would you like to extend it?
Payment Failed
We couldn't process your payment. Please update your payment method.
Subscription Renewed
Your subscription has been successfully renewed for another year.
Use Cases
Real-world alert usage examples.
Form Validation
Please fix the following errors:
- Email address is required
- Password must be at least 8 characters
- Please accept the terms and conditions
Success Message
Order Confirmed!
Your order #12345 has been placed successfully. You will receive a confirmation email shortly.
System Notification
Scheduled Maintenance
The system will be undergoing maintenance on Sunday, January 26th from 2:00 AM to 6:00 AM EST.
Warning Banner
Browser Not Supported
You are using an outdated browser. Please update to the latest version for the best experience.
Cookie Consent
We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.
API Reference
Complete list of props for the Alert component.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'solid' | 'soft' | 'outline' | 'soft' | Visual style variant of the alert |
color | 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'danger' | 'neutral' | Color theme of the alert |
title | ReactNode | - | Alert title text |
description | ReactNode | - | Alert description/message text |
icon | ReactNode | - | Custom icon to display |
showIcon | boolean | true | Whether to show the default icon based on color |
dismissible | boolean | false | Whether the alert can be dismissed |
onDismiss | () => void | - | Callback when alert is dismissed |
action | ReactNode | - | Action element (button, link, etc.) |
size | 'sm' | 'md' | 'lg' | 'md' | Size of the alert |
role | string | 'alert' | ARIA role — use 'status' for non-critical messages |
children | ReactNode | - | Alert content (alternative to description) |
className | string | - | Additional CSS classes |
Accessibility
- Uses
role="alert"by default for important messages - Includes
aria-live="assertive"for screen reader announcements - Dismiss button has
aria-label="Dismiss alert"for accessibility - Icons are hidden from screen readers with
aria-hidden="true" - Color contrast meets WCAG AA standards for all variants
- Keyboard accessible - dismiss button can be focused and activated
- Supports custom
roleprop for different use cases (e.g.,role="status")