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

Spinner

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

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/spinner.tsx

Update the import paths to match your project setup.

Usage

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 }

Size

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…

RTL

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

Loading JGuang UI example…

Source: components/base/spinner.mdx

Technical documentation for JGuang UI.

On this page