# V spinner 10

> Basic spinner

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-spinner-10).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-spinner-10
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-spinner-10-light-19cf8303aeb92ea1.png
- Registry item: https://ui.cnippet.dev/r/v-spinner-10.json
- Categories: spinner
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-spinner-10.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/spinner`

## Files

### `registry/default/variants/v-spinner-10.tsx`

```tsx
"use client";

import { useState } from "react";
import { Button } from "@/registry/default/ui/button";
import { Spinner } from "@/registry/default/ui/spinner";

const STEPS = [
  "Connecting to server…",
  "Authenticating…",
  "Loading workspace…",
  "Almost there…",
];

export function Pattern() {
  const [stepIndex, setStepIndex] = useState<number | null>(null);

  function start() {
    setStepIndex(0);
    let i = 1;
    const interval = setInterval(() => {
      if (i >= STEPS.length) {
        clearInterval(interval);
        setTimeout(() => setStepIndex(null), 600);
        return;
      }
      setStepIndex(i);
      i++;
    }, 700);
  }

  const running = stepIndex !== null;

  return (
    <div className="flex w-full max-w-xs flex-col items-center gap-4">
      <div className="flex h-24 w-full items-center justify-center rounded-xl border bg-muted/30">
        {running ? (
          <div className="flex flex-col items-center gap-2">
            <Spinner className="size-5 text-primary" />
            <p className="text-muted-foreground text-xs">
              {STEPS[stepIndex ?? 0]}
            </p>
          </div>
        ) : (
          <p className="text-muted-foreground text-sm">Workspace ready</p>
        )}
      </div>
      <Button
        className="w-full"
        disabled={running}
        onClick={start}
        size="sm"
        variant="outline"
      >
        {running ? "Starting…" : "Launch workspace"}
      </Button>
    </div>
  );
}
```
