MiComponents/Documentation

Alert

Use alerts to display important messages or notifications to users with different severity levels.

Installation

npx micomponents-cli add alert

Preview

Usage

Import

import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
import { InfoIcon } from "lucide-react";

Basic Usage

<Alert variant="info">
  <InfoIcon className="h-4 w-4" />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    You can add components to your app using the cli.
  </AlertDescription>
</Alert>

Examples

Alert Variants

Use different variant props to display different alert types: info, success, warning, error, or white.

Custom Styling

Alerts are fully customizable with Tailwind CSS. Add custom className props or use AlertTitle and AlertDescription components.

API Reference

PropTypeDefaultDescription
variant"info" | "success" | "warning" | "error" | "white"infoThe type/severity of the alert
classNamestring-Additional custom classes