# V avatar 13

> With Loading State Demonstration

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

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

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-avatar-13.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/avatar`

## Files

### `registry/default/variants/v-avatar-13.tsx`

```tsx
"use client";

import { useEffect, useState } from "react";
import {
  Avatar,
  AvatarFallback,
  AvatarImage,
} from "@/registry/default/ui/avatar";
import { Spinner } from "@/registry/default/ui/spinner";

export function Pattern() {
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    const interval = setInterval(() => setLoading((prev) => !prev), 2000); // Toggle loading state every 3 seconds
    return () => clearInterval(interval);
  }, []);

  return (
    <div className="relative">
      <Avatar>
        <AvatarImage alt="@shadcn" src="https://github.com/shadcn.png" />
        <AvatarFallback>CN</AvatarFallback>
      </Avatar>
      {loading && (
        <div className="absolute inset-0 flex items-center justify-center rounded-full bg-background/60">
          <Spinner className="text-primary" />
        </div>
      )}
    </div>
  );
}
```
