# Spinner

A compact loading indicator with an optional visible label.

Access: free. Category: Feedback. Kind: primitive.

## When to use

- Use it when a product interface needs a compact loading indicator with an optional visible label.
- Choose it when the host application can supply the required state and keep business logic outside the presentation component.

## Alternatives

- Choose alert instead when inline notices with icons, actions and optional dismissal is the actual interface need, rather than spinner.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Spinner

```sh
npx shadcn@latest add https://tidalui.com/r/spinner.json
```

Stylesheets: `components/ui/tidal.css`, `components/ui/spinner.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/spinner.css";
import{TidalSpinner}from"./components/ui/spinner";
export default()=><div className="tidal-scope"><TidalSpinner decorative/></div>;
```

## Structured props

- `TidalSpinner.decorative?: boolean | undefined` (default false): Optional decorative value accepted by this exported component.
- `TidalSpinner.label?: string | undefined`: Optional label value accepted by this exported component.
- `TidalSpinner.labelVisible?: boolean | undefined` (default false): Optional label visible value accepted by this exported component.
- `TidalSpinner.paused?: boolean | undefined` (default false): Optional paused value accepted by this exported component.
- `TidalSpinner.size?: "sm" | "md" | "lg" | undefined` (default "md"): Optional size value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/spinner.tsx) | [Manifest](https://tidalui.com/examples/spinner.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
import "./components/ui/tidal.css";

import { useId, useState } from "react";

import { TidalSpinner } from "./components/ui/spinner";

import "./components/ui/spinner.css";



const tidalExampleStyles = ".tidal-scope .spinner-demo {\n  width: min(100%, 380px);\n  min-width: 0;\n}\n.tidal-scope .spinner-demo-stage {\n  min-height: 150px;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  padding: 24px 8px;\n}\n.tidal-scope .spinner-demo-controls {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  border-top: 1px solid var(--t-border);\n  padding-top: 16px;\n}\n.tidal-scope .spinner-demo-controls label {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  color: var(--t-muted);\n  font-size: 12px;\n}\n.tidal-scope .spinner-demo-controls select,\n.tidal-scope .spinner-demo-controls button {\n  min-height: 44px;\n  border: 1px solid var(--t-border);\n  border-radius: var(--t-radius-control);\n  padding: 8px 12px;\n  color: var(--t-ink);\n  background: var(--t-surface);\n}\n.tidal-scope .spinner-demo-controls select {\n  font-size: 16px;\n}\n.tidal-scope .spinner-demo-controls button {\n  font-size: 12px;\n}";

export function SpinnerDemo() {
  const id = useId();
  const [size, setSize] = useState<"sm" | "md" | "lg">("md");
  const [paused, setPaused] = useState(false);
  return (
    <section className="spinner-demo" aria-label="Loading indicator preview">
      <div className="spinner-demo-stage">
        <TidalSpinner
          label="Loading activity"
          labelVisible
          size={size}
          paused={paused}
        />
      </div>
      <div className="spinner-demo-controls">
        <label htmlFor={`${id}-size`}>
          Size{" "}
          <select
            id={`${id}-size`}
            value={size}
            onChange={(event) =>
              setSize(event.currentTarget.value as "sm" | "md" | "lg")
            }
          >
            <option value="sm">Small</option>
            <option value="md">Medium</option>
            <option value="lg">Large</option>
          </select>
        </label>
        <button type="button" onClick={() => setPaused((value) => !value)}>
          {paused ? "Resume animation" : "Pause animation"}
        </button>
      </div>
    </section>
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <SpinnerDemo />
    </div>
  );
}

```

## Gotchas

- Install the declared registry dependencies and render inside a tidal-scope with the foundation stylesheet loaded.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

Provide a required label for the polite status mode, or decorative=true to omit announcements inside an already labelled busy control. Optional labelVisible, size (sm=16px, md=24px default, lg=36px), paused (animation only), native span attributes/ref/className/style. A whitespace-only label falls back to Loading. Reduced motion uses a static dotted ring. This component does not own task state, timers, requests, navigation or storage.
