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

加载指示器

表达等待或后台处理中的状态。

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

安装

Command

Manual

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

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

View complete source: components/ui/spinner.tsx

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

用法

import { Spinner } from "@/components/ui/spinner"
<Spinner />

Customization

You can replace the default spinner icon with any other icon by editing the Spinner component.

Loading JGuang UI example…
import { LoaderIcon } from "lucide-react"

import { cn } from "@/lib/utils"

function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
  return (
    <LoaderIcon
      role="status"
      aria-label="Loading"
      className={cn("size-4 animate-spin", className)}
      {...props}
    />
  )
}

export { Spinner }

尺寸

Use the size-* utility class to change the size of the spinner.

Loading JGuang UI example…

Button

Add a spinner to a button to indicate a loading state. Place the `` before the label with data-icon="inline-start" for a start position, or after the label with data-icon="inline-end" for an end position.

Loading JGuang UI example…

Badge

Add a spinner to a badge to indicate a loading state. Place the `` before the label with data-icon="inline-start" for a start position, or after the label with data-icon="inline-end" for an end position.

Loading JGuang UI example…

Input Group

Loading JGuang UI example…

Empty

Loading JGuang UI example…

从右到左布局

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

Loading JGuang UI example…

来源: components/base/spinner.mdx

JGuang UI 技术文档。

On this page