Alert
Displays a callout for user attention.
Heads up!
You can add components and dependencies to your app using the CLI.
Installation
npm
npx curv-ui add alert
Usage
tsx
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"<Alert variant="default | warning | error | success" onClose={handleClose}><AlertTitle>Heads up!</AlertTitle><AlertDescription>You can add components and dependencies to your app using the cli.</AlertDescription></Alert>
Variants
Default Alert
This is a default alert example inside the preview.
tsx
<Alert variant="default"><AlertTitle>Default Alert</AlertTitle><AlertDescription>This is a default alert example.</AlertDescription></Alert>
OnClose Callback
This is an alert title
This is an alert description. This is an alert description. This is an alert description.
tsx
'use client';import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";import { useState } from "react";export default function Test(){const [ showAlert, setShowAlert ] = useState(true);return(<>{showAlert && <Alert variant={"default"} onClose={() => setShowAlert(false)}><AlertTitle>This is an alert title</AlertTitle><AlertDescription>This is an alert description. This is an alert description. This isan alert description.</AlertDescription></Alert>}</>)}