---
title: Spinner
description: An indicator that can be used to show a loading state.
component: true
---
## Installation
CLIManual
```bash
npx shadcn@latest add spinner
```
Copy and paste the following code into your project.Update the import paths to match your project setup.
## Usage
```tsx
import { Spinner } from "@/components/ui/spinner"
```
```tsx
```
## Customization
You can replace the default spinner icon with any other icon by editing the `Spinner` component.
```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 (
)
}
export { Spinner }
```
## Examples
### Size
Use the `size-*` utility class to change the size of the spinner.
### Color
Use the `text-` utility class to change the color of the spinner.
### Button
Add a spinner to a button to indicate a loading state. The `` will handle the spacing between the spinner and the text.
### Badge
You can also use a spinner inside a badge.
### Input Group
Input Group can have spinners inside ``.
### Empty
### Item
Use the spinner inside `` to indicate a loading state.
## API Reference
### Spinner
Use the `Spinner` component to display a spinner.
| Prop | Type | Default |
| ----------- | -------- | ------- |
| `className` | `string` | `` |
```tsx
```