Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

feat: avatar-circles (#31)

Tomonari Feehan2e91a99c1039
diff --git a/config/docs.ts b/config/docs.ts
index c6d2ca10..d42cd09f 100644
--- a/config/docs.ts
+++ b/config/docs.ts
@@ -83,6 +83,12 @@ export const docsConfig: DocsConfig = {
items: [],
label: "New",
},
+ {
+ title: "Avatar Circles",
+ href: `/docs/components/avatar-circles`,
+ items: [],
+ label: "New",
+ },
],
},
{
diff --git a/content/docs/components/avatar-circles.mdx b/content/docs/components/avatar-circles.mdx
new file mode 100644
index 00000000..b6affe53
--- /dev/null
+++ b/content/docs/components/avatar-circles.mdx
@@ -0,0 +1,30 @@
+---
+title: Avatar Circles
+date: 2024-05-22
+description: Overlapping circles of avatars.
+author: tomonarifeehan
+published: true
+---
+
+<ComponentPreview name="avatar-circles-demo" />
+
+<Steps>
+
+### Installation
+
+Copy and paste the following code into your project.
+
+```text
+components/magicui/avatar-circles.tsx
+```
+
+<ComponentSource name="avatar-circles" />
+
+</Steps>
+
+## Props
+
+| Prop | Type | Description | Default |
+| ----------- | --------------- | -------------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| numPeople | number | The number appearing in the last circle | 99 |
\ No newline at end of file
diff --git a/registry/components/example/avatar-circles-demo.tsx b/registry/components/example/avatar-circles-demo.tsx
new file mode 100644
index 00000000..133688f5
--- /dev/null
+++ b/registry/components/example/avatar-circles-demo.tsx
@@ -0,0 +1,5 @@
+import AvatarCircles from "@/registry/components/magicui/avatar-circles";
+
+export default async function AvatarCirclesDemo() {
+ return <AvatarCircles numPeople={99} />;
+}
diff --git a/registry/components/example/word-rotate-demo.tsx b/registry/components/example/word-rotate-demo.tsx
index 89e473eb..dd0b9423 100644
--- a/registry/components/example/word-rotate-demo.tsx
+++ b/registry/components/example/word-rotate-demo.tsx
@@ -1,6 +1,6 @@
import WordRotate from "@/registry/components/magicui/word-rotate";
-export default async function TextRevealDemo() {
+export default async function WordRotateDemo() {
return (
<WordRotate
className="text-4xl font-bold text-black dark:text-white"
diff --git a/registry/components/magicui/avatar-circles.tsx b/registry/components/magicui/avatar-circles.tsx
new file mode 100644
index 00000000..d7e69424
--- /dev/null
+++ b/registry/components/magicui/avatar-circles.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+
+interface AvatarCirclesProps {
+ className?: string;
+ numPeople?: number;
+}
+
+export default function AvatarCircles({
+ numPeople,
+ className,
+}: AvatarCirclesProps) {
+ return (
+ <div className={cn("z-10 flex -space-x-4 rtl:space-x-reverse", className)}>
+ <img
+ className="h-10 w-10 rounded-full border-2 border-white dark:border-gray-800"
+ src="https://avatars.githubusercontent.com/u/16860528"
+ alt=""
+ />
+ <img
+ className="h-10 w-10 rounded-full border-2 border-white dark:border-gray-800"
+ src="https://avatars.githubusercontent.com/u/29210732"
+ alt=""
+ />
+ <img
+ className="h-10 w-10 rounded-full border-2 border-white dark:border-gray-800"
+ src="https://avatars.githubusercontent.com/u/20110627"
+ alt=""
+ />
+ <a className="flex h-10 w-10 items-center justify-center rounded-full border-2 border-white bg-black text-center text-xs font-medium text-white hover:bg-gray-600 dark:border-gray-800 dark:bg-white dark:text-black">
+ +{numPeople}
+ </a>
+ </div>
+ );
+}
diff --git a/registry/index.tsx b/registry/index.tsx
index 1614f626..fa1720f7 100644
--- a/registry/index.tsx
+++ b/registry/index.tsx
@@ -142,6 +142,11 @@ const ui: Registry = {
type: "components:ui",
files: ["registry/components/magicui/word-rotate.tsx"],
},
+ "avatar-circles": {
+ name: "avatar-circles",
+ type: "components:ui",
+ files: ["registry/components/magicui/avatar-circles.tsx"],
+ },
"typing-animation": {
name: "typing-animation",
type: "components:ui",
@@ -590,6 +595,14 @@ const example: Registry = {
() => import("@/registry/components/example/word-rotate-demo"),
),
},
+ "avatar-circles-demo": {
+ name: "avatar-circles-demo",
+ type: "components:example",
+ files: ["registry/components/example/avatar-circles-demo.tsx"],
+ component: React.lazy(
+ () => import("@/registry/components/example/avatar-circles-demo"),
+ ),
+ },
"typing-animation-demo": {
name: "typing-animation-demo",
type: "components:example",