Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Avatar Group

    Overlapping stack of avatars that spreads out on hover, shows each name in a tooltip, and collapses extra people into a +N chip.

    Dewi Lestari BS SA JC 3 more
    7 people on this project
    Dewi LestariBSSAJC3 more
    7 people on this project
    Dewi LestariBSSAJC3 more
    7 people on this project
    Dewi LestariBSSAJC 3 more
    7 people on this project
    Dewi LestariBSSAJC3 more
    7 people on this project
    @php
        $team = [
            ['name' => 'Dewi Lestari', 'src' => "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E"],
            ['name' => 'Budi Santoso'],
            ['name' => 'Siti Aminah'],
            ['name' => 'John Carter'],
            ['name' => 'Maya Putri'],
            ['name' => 'Rizal Hakim'],
            ['name' => 'Ana Lim'],
        ];
    @endphp
    
    <div class="flex items-center gap-3 pt-8">
        <x-markas.avatar-group :items="$team" group-label="Project members" />
        <span class="text-sm text-muted">7 people on this project</span>
    </div>
    import { AvatarGroup } from "@/components/markas/AvatarGroup";
    
    const photo =
      "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E";
    
    const team = [
      { name: "Dewi Lestari", src: photo },
      { name: "Budi Santoso" },
      { name: "Siti Aminah" },
      { name: "John Carter" },
      { name: "Maya Putri" },
      { name: "Rizal Hakim" },
      { name: "Ana Lim" },
    ];
    
    export default function AvatarGroupExample() {
      return (
        <div className="flex items-center gap-3 pt-8">
          <AvatarGroup items={team} groupLabel="Project members" />
          <span className="text-sm text-muted">7 people on this project</span>
        </div>
      );
    }
    <script setup lang="ts">
    import AvatarGroup from "@/components/markas/AvatarGroup.vue";
    
    const photo =
      "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E";
    
    const team = [
      { name: "Dewi Lestari", src: photo },
      { name: "Budi Santoso" },
      { name: "Siti Aminah" },
      { name: "John Carter" },
      { name: "Maya Putri" },
      { name: "Rizal Hakim" },
      { name: "Ana Lim" },
    ];
    </script>
    
    <template>
      <div class="flex items-center gap-3 pt-8">
        <AvatarGroup :items="team" group-label="Project members" />
        <span class="text-sm text-muted">7 people on this project</span>
      </div>
    </template>
    <script lang="ts">
      import AvatarGroup from "$lib/components/markas/AvatarGroup.svelte";
    
      const photo =
        "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E";
    
      const team = [
        { name: "Dewi Lestari", src: photo },
        { name: "Budi Santoso" },
        { name: "Siti Aminah" },
        { name: "John Carter" },
        { name: "Maya Putri" },
        { name: "Rizal Hakim" },
        { name: "Ana Lim" },
      ];
    </script>
    
    <div class="flex items-center gap-3 pt-8">
      <AvatarGroup items={team} groupLabel="Project members" />
      <span class="text-sm text-muted">7 people on this project</span>
    </div>
    ---
    import AvatarGroup from "@/components/markas/AvatarGroup.astro";
    
    const photo =
      "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E";
    
    const team = [
      { name: "Dewi Lestari", src: photo },
      { name: "Budi Santoso" },
      { name: "Siti Aminah" },
      { name: "John Carter" },
      { name: "Maya Putri" },
      { name: "Rizal Hakim" },
      { name: "Ana Lim" },
    ];
    ---
    
    <div class="flex items-center gap-3 pt-8">
      <AvatarGroup items={team} groupLabel="Project members" />
      <span class="text-sm text-muted">7 people on this project</span>
    </div>
    import { Component } from "@angular/core";
    import { AvatarGroup } from "./markas/avatar-group.component";
    
    const photo =
      "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Crect width='48' height='48' fill='rgb(46 107 58)'/%3E%3Ccircle cx='24' cy='19' r='8' fill='rgb(231 239 229)'/%3E%3Cpath d='M8 46c1-9 8-15 16-15s15 6 16 15z' fill='rgb(231 239 229)'/%3E%3C/svg%3E";
    
    @Component({
      selector: "markas-example",
      imports: [AvatarGroup],
      template: `
        <div class="flex items-center gap-3 pt-8">
          <div
            markas-avatar-group
            [items]="team"
            groupLabel="Project members"
          ></div>
          <span class="text-sm text-muted">7 people on this project</span>
        </div>
      `,
    })
    export default class AvatarGroupExample {
      protected readonly team = [
        { name: "Dewi Lestari", src: photo },
        { name: "Budi Santoso" },
        { name: "Siti Aminah" },
        { name: "John Carter" },
        { name: "Maya Putri" },
        { name: "Rizal Hakim" },
        { name: "Ana Lim" },
      ];
    }

    Examples

    Sizes

    DL BS SA 2 more
    DL BS SA 2 more
    DL BS SA 2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA 2 more
    DLBSSA 2 more
    DLBSSA 2 more
    DLBSSA2 more
    DLBSSA2 more
    DLBSSA2 more

    In a project card

    Website redesign

    Due Friday, 14 of 20 tasks done

    On track
    Dewi Lestari BS SA 2 more
    70%

    Website redesign

    Due Friday, 14 of 20 tasks done

    On track
    Dewi LestariBSSA2 more
    70%

    Website redesign

    Due Friday, 14 of 20 tasks done

    On track
    Dewi LestariBSSA2 more
    70%

    Website redesign

    Due Friday, 14 of 20 tasks done

    On track
    Dewi LestariBSSA 2 more
    70%

    Website redesign

    Due Friday, 14 of 20 tasks done

    On track
    Dewi LestariBSSA2 more
    70%

    Liked by

    MP RH AL 3 more

    Maya Putri and 5 others liked this

    MPRHAL3 more

    Maya Putri and 5 others liked this

    MPRHAL3 more

    Maya Putri and 5 others liked this

    MPRHAL 3 more

    Maya Putri and 5 others liked this

    MPRHAL3 more

    Maya Putri and 5 others liked this

    Installation

    npx markasui@latest add avatar-group

    Usage

    <x-markas.avatar-group
        :items="[
            ['name' => 'Dewi Lestari', 'src' => '/avatars/dewi.jpg'],
            ['name' => 'Budi Santoso'],
            ['name' => 'Siti Aminah'],
            ['name' => 'John Carter'],
            ['name' => 'Maya Putri'],
        ]"
        :max="3"
        group-label="Project members"
    />
    import { AvatarGroup } from "@/components/markas/AvatarGroup";
    
    <AvatarGroup
      items={[
        { name: "Dewi Lestari", src: "/avatars/dewi.jpg" },
        { name: "Budi Santoso" },
        { name: "Siti Aminah" },
        { name: "John Carter" },
        { name: "Maya Putri" },
      ]}
      max={3}
      groupLabel="Project members"
    />;
    <template>
      <AvatarGroup :items="team" :max="3" group-label="Project members" />
    </template>
    <script lang="ts">
      import AvatarGroup from "$lib/components/markas/AvatarGroup.svelte";
    
      const team = [
        { name: "Dewi Lestari", src: "/dewi.jpg" },
        { name: "Budi Santoso" },
      ];
    </script>
    
    <AvatarGroup items={team} max={3} groupLabel="Project members" />
    ---
    import AvatarGroup from "@/components/markas/AvatarGroup.astro";
    
    const team = [{ name: "Dewi Lestari", src: "/dewi.jpg" }, { name: "Budi Santoso" }];
    ---
    
    <AvatarGroup items={team} max={3} groupLabel="Project members" />
    import { Component } from "@angular/core";
    import { AvatarGroup } from "./markas/avatar-group.component";
    
    @Component({
      selector: "app-members",
      imports: [AvatarGroup],
      template: `
        <div
          markas-avatar-group
          [items]="team"
          [max]="3"
          groupLabel="Project members"
        ></div>
      `,
    })
    export class Members {
      team = [{ name: "Dewi Lestari", src: "/dewi.jpg" }, { name: "Budi Santoso" }];
    }
    • No JavaScript needed. The Blade version does not need Alpine.js; hover effects are pure CSS.
    • People after max collapse into a +N chip. Its tooltip lists their names and screen readers hear moreLabel (“2 more”).
    • The ring between avatars uses the canvas color. On a card, set class="[--avatar-ring:var(--color-surface)]".
    • Tooltips sit above the group, so leave some space there.

    Props

    NameTypeDefaultDescription
    items{ name: string; src?: string }[][]People in the group. Without src, the initials of name are shown.
    maxnumber4Number of avatars shown before the rest collapse into a +N chip.
    size'sm' | 'md' | 'lg'mdAvatar size of 32, 40, or 48 pixels. The overlap scales with it.
    groupLabelstringMembersAccessible name of the group, such as "Project members".
    moreLabelstring{count} moreHidden text on the +N chip for screen readers. {count} is replaced with the number of hidden people.

    Accessibility

    • The stack is a group with an accessible name from groupLabel.
    • Each avatar is an image named after the person (alt or role img with aria-label), so screen readers do not need the tooltip.
    • Tooltips and the visible +N are aria-hidden; the chip announces moreLabel instead.
    • With reduced motion, the spread and lift happen instantly without a transition.

    Related components

    More animations components with the same classes in every framework.