---
title: "Spinner"
description: "A small ring that turns while something loads and you cannot say how long it takes. It comes in 12, 16, and 24px and takes the color of the text."
url: https://gelatinui.com/components/spinner
markdown_url: https://gelatinui.com/components/spinner.md
access: free
install: "npx shadcn@latest add @gelatin-ui/spinner"
registry_item: https://gelatinui.com/r/spinner.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Spinner

> A small ring that turns while something loads and you cannot say how long it takes. It comes in 12, 16, and 24px and takes the color of the text.

Page: https://gelatinui.com/components/spinner

## When to use it

Best for: A wait of unknown length while something loads.

- Use it when something loads and you do not know how long it takes.
- Set `aria-label` to the task in the language of the page, for example "Saving".

## When not to use it

- In a button, set `loading` on the [Button](https://gelatinui.com/components/button.md).
- When you know how much is done, show the percent done, not a spinner.

## Notes for agents

- Set `aria-label` to the task in the language of the page, such as "Saving".
- In a Button, set `loading` on the Button instead of a Spinner child.

## Anatomy

```text
Spinner
```

## API reference

### Spinner

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `"default" \| "lg" \| "sm"` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Spinner | `spinner` |  |  |  |

## Usage

Set `aria-label` to the task, such as "Loading invoices", in the language of the page.

```tsx title="invoice-list-loading.tsx"
import { Spinner } from "@/components/ui/spinner";

export function InvoiceListLoading() {
  return (
    <div className="flex h-40 items-center justify-center">
      <Spinner size="lg" aria-label="Loading invoices" className="text-muted-foreground" />
    </div>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/spinner
```

It adds 1 registry items: 1 files, 56 lines, and the npm packages `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Skeleton](https://gelatinui.com/components/skeleton.md)
- [Button](https://gelatinui.com/components/button.md)

## Accessibility

Spinner is a native `<output>` with the role `status`.

## Motion

| Part | Motion |
| --- | --- |
| Turn | animate-spin · 1s · linear · repeats |
