UI Components
Alert
An inline feedback component for displaying informational, success, warning, or error messages
Quick Preview
Changes saved
Your profile has been updated successfully.
Installation
# lucide-react is requirednpm install lucide-react// Copy the Alert component fromsrc/components/ui/Alert.tsx
Usage
import { Alert } from '@/components/ui/Alert'export default function Example() {return (<Alert type="info" title="Heads up" dismissible>You can update your settings at any time.</Alert>)}
Examples
All Types
This is an informational message.
Your changes have been saved.
You are running low on storage.
Failed to connect. Please retry.
With Title
Storage almost full
You have used 90% of your 5 GB storage. Upgrade your plan to add more space.
Dismissible Alert
New feature available
We just launched dark mode. Try it out in your settings.
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
type | "info" | "success" | "warning" | "error" | "info" | Type of alert โ determines color and icon |
title | string | - | Optional bold title above the message |
children* | React.ReactNode | - | Alert message content |
dismissible | boolean | false | Shows a close button to dismiss the alert |
className | string | - | Additional CSS classes |
Features
- โ4 semantic types: info, success, warning, error
- โAuto icon per type (lucide-react)
- โOptional title prop
- โDismissible with X button (Client Component)
- โARIA role="alert" for accessibility