Skip to content

Alert

Callout for important messages

Default

Usage

tsx
import { Alert, AlertTitle, AlertDescription } from '@tryvienna/ui'

<Alert className="w-96">
  <InfoIcon />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>You can add components to your app using the CLI.</AlertDescription>
</Alert>

Examples

Default

Default
tsx
<Alert className="w-96">
  <InfoIcon />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>You can add components to your app using the CLI.</AlertDescription>
</Alert>

Destructive

Destructive
tsx
<Alert variant="destructive" className="w-96">
  <AlertCircleIcon />
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>Your session has expired. Please log in again.</AlertDescription>
</Alert>

Warning

Warning
tsx
<Alert className="w-96">
  <AlertTriangleIcon />
  <AlertTitle>Warning</AlertTitle>
  <AlertDescription>
    This action cannot be undone. Please proceed with caution.
  </AlertDescription>
</Alert>

Without Icon

Without Icon
tsx
<Alert className="w-96">
  <AlertTitle>Note</AlertTitle>
  <AlertDescription>This is a simple alert without an icon.</AlertDescription>
</Alert>

Variants

NameOptionsDefault
variantdefault | destructivedefault

API Reference

Alert

PropTypeDefaultDescription
variant"default" | "destructive" | null | undefined-

Also accepts all props from div.

AlertTitle

Also accepts all props from div.

AlertDescription

Also accepts all props from div.

Data Attributes

Componentdata-slot
Alert"alert"
AlertTitle"alert-title"
AlertDescription"alert-description"