For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.1.0/en/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.1.0/en/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.1.0/en/components/alert.md.
  • English
  • v0.1.0
  • Alert

    Live previewHTML · CSS · JavaScript

    Payment successful

    Your payment of $29.99 has been processed. A receipt has been sent to your email address.

    New feature available

    We've added dark mode support. You can enable it in your account settings.

    Usage

    Include CSS

    Import Tailwind and one full A3S UI style bundle.

    @import "tailwindcss";
    @import "@a3s-lab/ui/a3s.css";

    Or import only the base CSS, Alert component CSS, and one style pack.

    @import "tailwindcss";
    @import "@a3s-lab/ui/base.css";
    @import "@a3s-lab/ui/components/alert.css";
    @import "@a3s-lab/ui/styles/a3s.css";

    Using CDN or bundler imports? See the Installation page.

    Add your alert HTML

    Use alert for default styling. Add data-variant="destructive" for error states. Add a direct child <footer> for an inline-end action region.

    <div class="alert"><svg class="lucide lucide-info" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" /></svg>
      <h2>Heads up!</h2>
      <section>You can add components and dependencies to your app.</section>
      <footer>
        <button type="button" class="btn" data-variant="outline">Enable</button>
      </footer>
    </div>

    HTML structure

    <div class="alert">

    Main container. Use data-variant="destructive" for error states.

    <svg> Optional
    The icon.
    <h2>
    The title.
    <section> Optional
    The description.
    <footer> Optional
    The action region, aligned to the inline end of the alert. Put the action element inside it, such as a button or link.

    Examples

    Basic

    A basic alert with an icon, title and description.

    Live previewHTML · CSS · JavaScript

    Account updated successfully

    Your profile information has been saved. Changes will be reflected immediately.

    Destructive

    Use data-variant="destructive" to create a destructive alert.

    Live previewHTML · CSS · JavaScript

    Payment failed

    Your payment could not be processed. Please check your payment method and try again.

    Action

    Use <footer> to add a button or other action element to the alert.

    Live previewHTML · CSS · JavaScript

    Dark mode is now available

    Enable it under your profile settings to get started.

    Custom colors

    You can customize the alert colors by adding custom classes such as bg-amber-50 dark:bg-amber-950 to the alert.

    Live previewHTML · CSS · JavaScript

    Your subscription will expire in 3 days.

    Renew now to avoid service interruption or upgrade to a paid plan to continue using the service.

    RTL

    Add dir="rtl" to the alert or an ancestor.

    Live previewHTML · CSS · JavaScript

    تم الدفع بنجاح

    تمت معالجة دفعتك البالغة 29.99 دولارًا. تم إرسال إيصال إلى عنوان بريدك الإلكتروني.

    ميزة جديدة متاحة

    لقد أضفنا دعم الوضع الداكن. يمكنك تفعيله في إعدادات حسابك.