# Spinner · JGuang UI

> An indicator that can be used to show a loading state.

- Page: https://jiguang132.com/systems/jguang-ui/docs/components/base/spinner
- Based on: shadcn/ui documentation (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c

> Example `spinner-demo`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/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/base/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.


> Example `spinner-custom`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/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.


> Example `spinner-size`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/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.


> Example `spinner-button`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/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.


> Example `spinner-badge`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/spinner


## Input Group


> Example `spinner-input-group`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/spinner


## Empty


> Example `spinner-empty`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/spinner


## RTL

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


> Example `spinner-rtl`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/base/spinner

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
