110k
New

Spinner

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

Component spinner-demo not found in registry.

Installation

pnpm dlx createui@latest add spinner

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.

Component spinner-custom not found in registry.

components/ui/spinner.tsx
import { RiLoaderLine } from "@remixicon/react"
 
import { cn } from "@/lib/utils"
 
function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
  return (
    <RiLoaderLine
      role="status"
      aria-label="Loading"
      className={cn("size-4 animate-spin", className)}
      {...props}
    />
  )
}
 
export { Spinner }

Examples

Size

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

Component spinner-size not found in registry.

Button

Add a spinner to a button to indicate a loading state. Remember to use the data-icon="inline-start" prop to add the spinner to the start of the button and the data-icon="inline-end" prop to add the spinner to the end of the button.

Component spinner-button not found in registry.

Badge

Add a spinner to a badge to indicate a loading state. Remember to use the data-icon="inline-start" prop to add the spinner to the start of the badge and the data-icon="inline-end" prop to add the spinner to the end of the badge.

Component spinner-badge not found in registry.

Input Group

Component spinner-input-group not found in registry.

Empty

Component spinner-empty not found in registry.