Skip to content

Avatar Group

Overlapping Tailwind CSS avatar stack in three sizes with initials, status dots, name tooltips and a +N counter that reveals hidden people.

Also known as: avatar stack, overlapping avatars, user avatar group, avatar list with counter, stacked profile pictures

Avatar Group live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

An overlapping avatar group built with Tailwind CSS, shown in three sizes with a "+N" counter that reveals the hidden people. Use it for collaborators on a project card, attendees of a meeting, reviewers of a pull request or "who is viewing this document" indicators.

How it works

The root is .tav-root. Each stack is a container marked data-tav-group that holds a ul with data-tav-list. Avatars are initials on gradient circles (.tav-avatar), so no images are required. The overlap comes from negative spacing utilities on the list (-space-x-1.5, -space-x-2, -space-x-3), and a ring in the background color of the card draws the white or violet cut-out between neighbours. The counter button data-tav-more sits in the last list item so the spacing stays consistent whether the stack is collapsed or expanded.

People beyond the visible limit are list items with data-tav-extra and the hidden attribute. On DOMContentLoaded the script finds every data-tav-group inside each .tav-root, counts its data-tav-extra items and writes the counter text itself, so the "+5" always matches the markup. Clicking the counter toggles hidden on the extras, adds the tav-in class to play the tav-pop animation, and switches the label to a minus sign. If a group has no extras, the counter is hidden. The large variant also fills data-tav-summary with the total number of people.

style.css gives earlier list items a higher z-index (:nth-child(1) to :nth-child(9)), so each circle covers the edge of the next one instead of hiding its initials. It also adds the name tooltip (.tav-tip) that appears on hover and lifts the hovered avatar above its neighbours.

Customization

  • Move data-tav-extra hidden to more or fewer list items: the counter updates automatically, e.g. "+3" instead of "+5".
  • Change h-11 w-11 on .tav-avatar and the matching -space-x-2 on data-tav-list to create another size; larger avatars need a larger negative space.
  • Swap from-violet-500 to-fuchsia-500 on an avatar for any gradient, or replace the initials with an img (https://placehold.co/88x88) with rounded-full object-cover.
  • ring-white / ring-violet-700 on avatars: match the ring color to the surface the group sits on.
  • The status dots (bg-emerald-400 online, bg-amber-300 away) in the large group can be removed or recolored; update the matching sr-only text.
  • bottom: calc(100% + 0.5rem) in .tav-tip: change to top to place the tooltip below the avatars.
  • Delete @keyframes tav-pop and the .tav-in rules to reveal avatars without animation.

Use cases

  • Project cards: show collaborators as overlapping initials with a +N counter for the rest
  • Meetings: list attendees and reveal hidden people by clicking the counter
  • Pull requests: display reviewers with name tooltips on hover
  • Document viewers: show who is viewing with online and away status dots

Accessibility

Each group is a real list with a descriptive aria-label. Initials are aria-hidden; every person has a visually hidden full name (including online or away status), so screen readers never read "AM, JL". The counter is a native button with aria-expanded, aria-controls pointing at its list and an aria-label such as "Show 5 more product launch members". It has a visible focus-visible outline, and all motion is disabled under prefers-reduced-motion: reduce.

Usage notes

Several groups and several .tav-root sections can live on one page; list ids are generated when missing.

Avatar Group at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Avatars
License
Free for personal and commercial use

Questions about this template

Can I use the Avatar Group code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Avatar Group – free Tailwind CSS avatar template
Avatar Group · free Tailwind CSS avatar template

More Avatars

Avatar Sizes and Shapes with Photos – free Tailwind CSS avatar template

Avatar Sizes and Shapes with Photos

Tailwind CSS avatar set with photos in six sizes, circle and rounded-square shapes, status dots, stacked groups and initials.

Story Ring Avatars with Gradient Border – free Pure CSS avatar template

Story Ring Avatars with Gradient Border

Pure CSS story avatars with Instagram-style gradient rings, close friends and live variants, and a seen state that turns the ring grey on click.

Avatars with Status Indicator – free Bootstrap 5 avatar template

Avatars with Status Indicator

Bootstrap 5 avatars in five sizes with online, away, busy and offline status dots, initials fallback for missing photos and a status picker.