Skip to main content

Quick Presets

Alert Type

Visual Style

Content

Options

Show Icon
Show Close Button
Show Shadow
Show Action Button

Animation

Auto Close

Enable Auto Close

Dimensions

8px
16px
400px

Position (Toast)

Live Preview

All Alert Types

Success Alert
Error Alert
Warning Alert
Info Alert
Neutral Alert
/* Alert Container */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  max-width: 400px;
  width: 100%;
  position: relative;
  background-color: #dcfce7;
  color: #22c55e;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Icon */
.alert-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Content */
.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.alert-message {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Close Button */
.alert-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  color: inherit;
  transition: opacity 0.2s ease;
}

.alert-close:hover {
  opacity: 1;
}

/* Animation */
@keyframes alert-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.alert { animation: alert-fade-in 0.3s ease; }

Common Use Cases

Form Validation

Show success or error messages after form submission

Your profile has been updated!

System Notifications

Inform users about important updates or maintenance

New features are now available!

Error Handling

Display error messages when something goes wrong

Failed to save changes. Try again.

Warning Messages

Alert users about potential issues or actions needed

Your subscription expires in 3 days

Best Practices

Clarity

  • Use clear, concise language
  • Include actionable information when relevant
  • Avoid technical jargon for user-facing alerts
  • Tell users what happened AND what to do next

Accessibility

  • Use role="alert" for important messages
  • Ensure 4.5:1 color contrast ratio
  • Don't rely solely on color to convey meaning
  • Make close buttons keyboard accessible

Placement

  • Position alerts near the relevant content
  • Use consistent positioning across your app
  • Toast notifications work best in corners
  • Inline alerts should appear within context

Timing

  • Show alerts immediately after the trigger action
  • Auto-close success messages after 3-5 seconds
  • Keep error messages visible until dismissed
  • Add progress bar for auto-closing alerts

Need a Custom Notification System?

Let our experts design and implement a comprehensive notification system tailored to your application's needs.