INFINITYUI
HomeComponentsDocsTemplates
Star

Getting Started

  • Introduction
  • Installation
  • CLI
  • Audit

Navigation

  • Spotlight Navbar
  • Glass DockNEW
  • Animated Tab Bar
  • Circle Menu
  • Magnet Tabs
  • Animated Sidebar
  • Apple Spotlight
  • Page TOC RailNEW

Text

  • Flip Text
  • Glitch Text
  • Liquid Text
  • Flip Fade Text
  • Mask Cursor Effect

Cards

  • Glow Border Card
  • Testimonials Card
  • Interactive Book
  • Trading CardsNEW
  • Hover Image
  • Chain of ThoughtNEW
  • Masonry Grid
  • Image Pile
  • Staggered Grid

Inputs

  • AI InputNEW
  • OTP Input
  • Leave Rating

Buttons

  • Social Flip Button
  • Creepy Button

Loaders

  • Jelly Loader
  • Rolling Ball Scroll
  • Glowing Scroll

Backgrounds

  • Light Lines
  • Perspective Grid
  • Liquid Ocean
  • Eagle Vision
  • Flow Scroll
  • Horizontal Scroll

Overlays

  • PersonaNEW
  • Infinite Moving Cards
  • Masked Avatars
  • Stacked Logos
  • Icon Wheel
  • Pixelated CarouselNEW
  • Pixelated Image Trail
  • Flip Scroll
  • Interactive Folder
  • Animated Folder IconNEW
  • Stack Scroll
  • Rubik Cube
Overlays

Masked Avatars

#avatar#mask#group
AL
BO
CH
DI
EV
+3

8 contributors this month

AL
BO
CH

Team members

implementedInfinityUI component

This component is fully implemented in InfinityUI and wired into the docs and registry flow.

Installation

Use the registry command to add the component source, and install any package dependencies if needed.

Infinity Registry

Install the component source into your project with the shadcn CLI.

npx shadcn@latest add https://infinityui-pearl.vercel.app/r/masked-avatars
Package Dependencies

Install the npm packages used by this component source.

No additional npm packages required.

Component Code

Copy and paste this code into your component file.

tsx
"use client";

interface MaskedAvatarsProps {
    /** Array of image URLs or initials fallback strings */
    avatars: Array<{ src?: string; name: string }>;
    /** Max avatars to show before +N. Default: 5 */
    max?: number;
    /** Size in px. Default: 40 */
    size?: number;
}

export function MaskedAvatars({ avatars, max = 5, size = 40 }: MaskedAvatarsProps) {
    const visible = avatars.slice(0, max);
    const overflow = avatars.length - max;

    return (
        <div className="flex items-center" role="group" aria-label={`${avatars.length} members`}>
            {visible.map((avatar, i) => (
                <div
                    key={i}
                    title={avatar.name}
                    className="relative rounded-full border-2 border-zinc-950 bg-gradient-to-br from-indigo-500 to-purple-600 flex items-center justify-center text-white font-bold overflow-hidden transition-transform duration-200 hover:scale-110 hover:z-10 cursor-pointer"
                    style={{
                        width: size,
                        height: size,
                        fontSize: size * 0.35,
                        marginLeft: i === 0 ? 0 : -(size * 0.3),
                        zIndex: visible.length - i,
                    }}
                >
                    {avatar.src ? (
                        <img
                            src={avatar.src}
                            alt={avatar.name}
                            className="w-full h-full object-cover"
                        />
                    ) : (
                        <span>{avatar.name.slice(0, 2).toUpperCase()}</span>
                    )}
                </div>
            ))}
            {overflow > 0 && (
                <div
                    className="relative rounded-full border-2 border-zinc-950 bg-zinc-800 flex items-center justify-center text-zinc-400 font-semibold"
                    style={{
                        width: size,
                        height: size,
                        fontSize: size * 0.32,
                        marginLeft: -(size * 0.3),
                    }}
                >
                    +{overflow}
                </div>
            )}
        </div>
    );
}