appica-dev

Alert

Component

About

A dismissible alert banner for surfacing status messages, warnings, or announcements with an icon, title, description, and optional actions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Alert to your project and fits it to your theme.

Code

How Alert is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import {
  Alert,
  AlertIcon,
  AlertTitle,
  AlertDescription,
} from "@/components/ui/alert";
import { Button } from "@appica/ui-react/button";
import { InfoCircleFilled } from "@appica/icons-react";

export default function AlertControlled() {
  const [open, setOpen] = React.useState(true);

  return (
    <div className="flex w-full max-w-md flex-col items-center gap-4">
      <div className="w-full">
        <Alert variant="info" open={open} onOpenChange={setOpen} dismissible>
          <AlertIcon>
            <InfoCircleFilled />
          </AlertIcon>
          <AlertTitle>Good to know</AlertTitle>
          <AlertDescription>
            This banner is controlled. Dismiss it and bring it back below.
          </AlertDescription>
        </Alert>
      </div>
      {!open && (
        <Button variant="outline" size="sm" onClick={() => setOpen(true)}>
          Show alert
        </Button>
      )}
    </div>
  );
}

Dependencies

More by appica-dev

View all
  • Border Beam

    Border Beam

    42
  • Text Animate

    Text Animate

    19
  • Carousel

    Carousel

    14
  • Sparkline

    Sparkline

    7
  • Table of Contents

    Table of Contents

    6
  • Color Area

    Color Area

    6
  • Avatar

    Avatar

    6
  • Background Pattern

    Background Pattern

    3