Faber UI
Components

Alert

A callout for contextual feedback messages.

Alert is a styled div with role="alert". It supports a default and a destructive variant, and an optional action slot.

Installation

Terminal
pnpm dlx shadcn@latest add https://faber-ui.vercel.app/r/alert.json

Usage

typescript
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";

export default function Example() {
  return (
    <Alert>
      <AlertTitle>Heads up</AlertTitle>
      <AlertDescription>You can add components via the CLI.</AlertDescription>
    </Alert>
  );
}

Examples

Variants

With an action

Use AlertAction to place a button in the corner of the alert:

typescript
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";

export default function Example() {
  return (
    <Alert>
      <AlertTitle>New version available</AlertTitle>
      <AlertDescription>v2.0 is ready to install.</AlertDescription>
      <AlertAction>
        <Button size="sm">Update</Button>
      </AlertAction>
    </Alert>
  );
}

Components

ComponentDescription
AlertRoot container. Accepts variant ("default" or "destructive").
AlertTitleBold heading.
AlertDescriptionMuted body text.
AlertActionPositioned in the inline-end corner.

Last updated on

On this page