Getting Started
Components
Special Effects
Animations
Text Animations
Backgrounds
A component displaying user avatars in a stacked, overlapping circle layout with an optional count badge.
avatar-circles.svelte
<script lang="ts"> import { AvatarCircles } from "$lib/components/magic/avatar-circles/index.js";
const avatars = [ { imageUrl: "https://avatars.githubusercontent.com/u/16860528", profileUrl: "https://github.com/dillionverma", }, { imageUrl: "https://avatars.githubusercontent.com/u/20110627", profileUrl: "https://github.com/tomonarifeehan", }, { imageUrl: "https://avatars.githubusercontent.com/u/106103625", profileUrl: "https://github.com/BankkRoll", }, { imageUrl: "https://avatars.githubusercontent.com/u/59228569", profileUrl: "https://github.com/safethecode", }, { imageUrl: "https://avatars.githubusercontent.com/u/59442788", profileUrl: "https://github.com/sanjay-mali", }, { imageUrl: "https://avatars.githubusercontent.com/u/89768406", profileUrl: "https://github.com/itsarghyadas", }, ];</script>
<AvatarCircles numPeople={99} avatarUrls={avatars} />Installation
pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/avatar-circles.json
Copy the Source Code
Copy and paste the following code into your project:
avatar-circles.svelte
<script lang="ts"> import type { ClassValue } from "svelte/elements"; import { cn } from "#lib/utils.js";
interface Avatar { imageUrl: string; profileUrl: string; }
interface Props { class?: ClassValue; numPeople?: number; avatarUrls: Avatar[]; }
let { class: className, numPeople, avatarUrls }: Props = $props();</script>
<div class={cn("z-10 flex -space-x-4 rtl:space-x-reverse", className)}> {#each avatarUrls as url, index} <a href={url.profileUrl} target="_blank" rel="noopener noreferrer"> <img class="h-10 w-10 rounded-full border-2 dark:border-gray-800" src={url.imageUrl} width="40" height="40" alt="Avatar {index + 1}" /> </a> {/each} {#if (numPeople ?? 0) > 0} <a class="flex h-10 w-10 items-center justify-center rounded-full border-2 bg-black text-center text-xs font-medium text-white hover:bg-gray-600 dark:border-gray-800 dark:bg-white dark:text-black" href="/" > +{numPeople} </a> {/if}</div> index.ts
import AvatarCircles from "./avatar-circles.svelte";export { AvatarCircles };Folder Structure
Folder Structure
src└── lib └── components └── magic-ui └── avatar-circles ├── avatar-circles.svelte └── index.tsInstall and integrate the Svelte component documented below.https://sv-animations.vercel.app/magic/docs/components/avatar-circles/llms.txt
Follow the guide's installation and usage instructions.Match the project's existing structure, imports, and styles.Keep changes scoped to the component and verify it works.Reply with a short bullet list of completed changes.Usage
<script lang="ts"> import { AvatarCircles } from "#lib/components/magic/avatar-circles/index.js";
const avatars = [ { imageUrl: "https://github.com/shadcn.png", profileUrl: "https://github.com/shadcn", }, ];</script>
<AvatarCircles avatarUrls={avatars} numPeople={12} />Props
Avatar Circles
A component that displays user avatars in a stacked, overlapping circle layout.
| Name | Type | Default | Description |
|---|---|---|---|
avatarUrls | Avatar[] | required | Array of avatar objects with imageUrl and profileUrl properties |
numPeople | number | undefined | Optional number to display in the count badge (e.g., +99) |
class | ClassValue | "" | Additional CSS classes to apply |