# 加载指示器 · JGuang UI

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

- 页面: https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner
- 改编自: shadcn/ui 文档 (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c
- 说明：正文保留英文原文。

> 示例 `spinner-demo`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## Installation


  

**Command**


  

**Manual**


```text
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/spinner.tsx](/r/jguang-ui/radix/spinner.json)


### Update the import paths to match your project setup.


## Usage

```tsx
import { Spinner } from "@/components/ui/spinner"
```

```tsx
<Spinner />
```

## Customization

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


> 示例 `spinner-custom`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


```tsx showLineNumbers title="components/ui/spinner.tsx"
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 }
```

## Size

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


> 示例 `spinner-size`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## 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.


> 示例 `spinner-button`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## 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.


> 示例 `spinner-badge`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## Input Group


> 示例 `spinner-input-group`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## Empty


> 示例 `spinner-empty`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> 示例 `spinner-rtl`: 交互预览见 https://jiguang132.com/zh/systems/jguang-ui/docs/components/radix/spinner

---

JGuang 全部资源索引: https://jiguang132.com/llms.txt
