Alert

Displays a callout for important information.

Installation

Add this component to your project using the npui CLI:

npx npui add alert

Variants & Examples

Default Alert

A standard alert for general information.

1import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
2import { Terminal } from 'lucide-react';
3
4export function MyAlert() {
5  return (
6    <Alert>
7      <Terminal className="h-4 w-4" />
8      <AlertTitle>Heads up!</AlertTitle>
9      <AlertDescription>
10        You can add components to your app using the cli.
11      </AlertDescription>
12    </Alert>
13  );
14}

Props

These are the available props for the Alert component:

PropTypeDescriptionDefault
variant"default" | "destructive"The visual style of the alert."default"
childrenReact.ReactNodeThe content of the alert (AlertTitle, AlertDescription, etc.).-