Alerts
solid and outline variations, this component now features three completely modern aesthetics: modern (SaaS style), glass (glassmorphism), and glow (dark mode neon).Alert
- Pass
title - and
messagefor the heading and body text. type"success"- picks the semantic colour scheme.
variant"modern"- sets the visual style — a card with a coloured left rail and shadow.
icon"CheckCircle2"- names an icon from the block's
ICON_MAP.
Installation
New project? Follow the installation guide to set up Tailwind CSS, shadcn, the cn helper and lucide-react, register the @algorize-ui registry once, then copy your styles from the Themes page.
Install Alert
components/ is written into your project. Copy any snippet from a Usage tab above and it runs.
Install dependencies
Nothing beyond the shared setup — Alert needs only the cn helper and lucide-react, which the installation guide already put in place.
Examples
Semantic types
- Use
type - to pick the semantic colour scheme —
primary,secondary,success,danger,warning,infoordark. It tints every variant the same way.
Variants
variant"solid"- gives a tinted background with a matching border.
variant"outline"- gives a plain surface with a coloured border only.
variant"modern"- is the card style — coloured left rail and a shadow.
Glass
- Set
variant"glass" - to frost the alert with a slow shimmer sweep — it needs a gradient or image behind it to read.
Glow
- Set
variant"glow" - for a neon border, shadow and a pulsing icon — built for dark dashboards.
Icons
icon"Info"- renders a Lucide icon when the string is a key of
ICON_MAP—CheckCircle2,AlertTriangle,Info,Bell,XCircle. icon"🚀"- any other string is rendered as-is, so emoji work.
icon- omitted (or
null) gives a text-only alert.
Dismissible
- Set
dismissible - to add a close button that animates the alert out.
onDismiss- fires after that animation, so it is where you drop the alert from your own state.
Rich content
- Pass
children - to render buttons, lists or any markup. It appears below
messagerather than replacing it, so omitmessagewhen the children say it all.
Features
Customizable
Easily adapt the component's styling and behavior to fit your application's unique design system.
Accessible
Built with accessibility in mind, ensuring all users can interact with your application effectively.
Responsive
Fully responsive design that looks and works great across desktop, tablet, and mobile devices.
Performant
Optimized for maximum performance with minimal re-renders and efficient state management.
Best Practices & Guidelines
Usage Guidelines
Follow standard design principles when implementing this component. Ensure proper contrast, spacing, and context within your layout.
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
type | | "primary" | Determines the semantic color scheme of the alert. |
variant | "solid" | "outline" | "modern" | "glass" | "glow" | "modern" | Applies overarching structural layouts and visual styles. |
dismissible | boolean | false | If true, renders an "X" button that smoothly animates the alert out of
the DOM. |
icon | string | ReactNode | null | The icon to display. You can pass a string matching the
ICON_MAP, an emoji, or a custom SVG. |
title | string | null | The bold header text of the alert. |