Alert

Display an important status message with a clear action or next step.

Preview

Usage

import {
  Alert,
  AlertDescription,
  AlertTitle,
} from '@vitnode/core/components/ui/alert'
import { TriangleAlertIcon } from 'lucide-react'
<Alert variant="warning">
  <TriangleAlertIcon />
  <AlertTitle>Heads up</AlertTitle>
  <AlertDescription>Something needs your attention.</AlertDescription>
</Alert>

An optional leading icon is picked up automatically - render any icon as the first child and the layout aligns it with the title and description.

Variants

  • default - neutral, informational messages.
  • warning - a non-blocking caution the user should act on (amber).
  • destructive - an error or a failed action (red).

Dismissible

Wrap a control in AlertAction to pin it to the top-right corner, e.g. a close button. The alert reserves space for it automatically.

import { AlertAction } from '@vitnode/core/components/ui/alert'
import { Button } from '@vitnode/core/components/ui/button'
import { XIcon } from 'lucide-react'

;<Alert variant="warning">
  <TriangleAlertIcon />
  <AlertTitle>Heads up</AlertTitle>
  <AlertDescription>Something needs your attention.</AlertDescription>
  <AlertAction>
    <Button aria-label="Dismiss" size="icon" variant="ghost">
      <XIcon />
    </Button>
  </AlertAction>
</Alert>

Props

Prop

Type