JGuang / JGuang UI
Components组件Base UIBase UI 组件

Alert

Displays a callout for user attention.

Partially translated: Chinese navigation, titles, descriptions, and common headings. The technical body is currently in English.
Loading JGuang UI example…

Installation

Command

Manual

Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.

Copy and paste the following code into your project.

View complete source: components/ui/alert.tsx

Update the import paths to match your project setup.

Usage

import {
  Alert,
  AlertAction,
  AlertDescription,
  AlertTitle,
} from "@/components/ui/alert"
<Alert>
  <InfoIcon />
  <AlertTitle>Heads up!</AlertTitle>
  <AlertDescription>
    You can add components and dependencies to your app using the cli.
  </AlertDescription>
  <AlertAction>
    <Button variant="outline">Enable</Button>
  </AlertAction>
</Alert>

Composition

Use the following composition to build an Alert:

Alert
├── Icon
├── AlertTitle
├── AlertDescription
└── AlertAction

Basic

A basic alert with an icon, title and description.

Loading JGuang UI example…

Destructive

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

Loading JGuang UI example…

Action

Use AlertAction to add a button or other action element to the alert.

Loading JGuang UI example…

Custom Colors

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

Loading JGuang UI example…

RTL

To enable RTL support in JGuang UI, see the RTL configuration guide.

Loading JGuang UI example…

API Reference

Alert

The Alert component displays a callout for user attention.

PropTypeDefault
variant"default" | "destructive""default"

AlertTitle

The AlertTitle component displays the title of the alert.

PropTypeDefault
classNamestring-

AlertDescription

The AlertDescription component displays the description or content of the alert.

PropTypeDefault
classNamestring-

AlertAction

The AlertAction component displays an action element (like a button) positioned absolutely in the top-right corner of the alert.

PropTypeDefault
classNamestring-

Source: components/base/alert.mdx

Technical documentation for JGuang UI.

On this page