JGuang / JGuang UI
Components组件Radix UIRadix UI 组件

提示

向用户展示需要关注的重要消息和状态。

中文模式已适配导航、标题、简介、目录与常用章节名称。翻译状态:部分完成;技术正文目前仍为英文。
Loading JGuang UI example…

安装

Command

Manual

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

将以下代码复制到你的项目中。

View complete source: components/ui/alert.tsx

根据项目配置更新导入路径。

用法

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…

危险操作

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…

从右到左布局

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

Loading JGuang UI example…

API 参考

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-

来源: components/radix/alert.mdx

JGuang UI 技术文档。

On this page