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.
@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
DLDewi Lestari
BSBudi Santoso
SASiti Aminah
+22 moreJohn Carter, Maya Putri
DLDewi Lestari
BSBudi Santoso
SASiti Aminah
+22 moreJohn Carter, Maya Putri
DLDewi Lestari
BSBudi Santoso
SASiti Aminah
+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah +22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah +22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah +22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
DLDewi LestariBSBudi SantosoSASiti Aminah+22 moreJohn Carter, Maya Putri
@php
$team = [
['name' => 'Dewi Lestari'],
['name' => 'Budi Santoso'],
['name' => 'Siti Aminah'],
['name' => 'John Carter'],
['name' => 'Maya Putri'],
];
@endphp
<div class="flex flex-col gap-5 pt-8">
<x-markas.avatar-group :items="$team" size="sm" :max="3" group-label="Small" />
<x-markas.avatar-group :items="$team" :max="3" group-label="Medium" />
<x-markas.avatar-group :items="$team" size="lg" :max="3" group-label="Large" />
</div>import { AvatarGroup } from "@/components/markas/AvatarGroup";
const team = [
{ name: "Dewi Lestari" },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
export default function Example() {
return (
<div className="flex flex-col gap-5 pt-8">
<AvatarGroup items={team} size="sm" max={3} groupLabel="Small" />
<AvatarGroup items={team} max={3} groupLabel="Medium" />
<AvatarGroup items={team} size="lg" max={3} groupLabel="Large" />
</div>
);
}<script setup lang="ts">
import AvatarGroup from "@/components/markas/AvatarGroup.vue";
const team = [
{ name: "Dewi Lestari" },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
</script>
<template>
<div class="flex flex-col gap-5 pt-8">
<AvatarGroup :items="team" size="sm" :max="3" group-label="Small" />
<AvatarGroup :items="team" :max="3" group-label="Medium" />
<AvatarGroup :items="team" size="lg" :max="3" group-label="Large" />
</div>
</template><script lang="ts">
import AvatarGroup from "$lib/components/markas/AvatarGroup.svelte";
const team = [
{ name: "Dewi Lestari" },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
</script>
<div class="flex flex-col gap-5 pt-8">
<AvatarGroup items={team} size="sm" max={3} groupLabel="Small" />
<AvatarGroup items={team} max={3} groupLabel="Medium" />
<AvatarGroup items={team} size="lg" max={3} groupLabel="Large" />
</div>---
import AvatarGroup from "@/components/markas/AvatarGroup.astro";
const team = [
{ name: "Dewi Lestari" },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
---
<div class="flex flex-col gap-5 pt-8">
<AvatarGroup items={team} size="sm" max={3} groupLabel="Small" />
<AvatarGroup items={team} max={3} groupLabel="Medium" />
<AvatarGroup items={team} size="lg" max={3} groupLabel="Large" />
</div>import { Component } from "@angular/core";
import { AvatarGroup } from "./markas/avatar-group.component";
@Component({
selector: "markas-example",
imports: [AvatarGroup],
template: `
<div class="flex flex-col gap-5 pt-8">
<div
markas-avatar-group
[items]="team"
size="sm"
[max]="3"
groupLabel="Small"
></div>
<div
markas-avatar-group
[items]="team"
[max]="3"
groupLabel="Medium"
></div>
<div
markas-avatar-group
[items]="team"
size="lg"
[max]="3"
groupLabel="Large"
></div>
</div>
`,
})
export default class AvatarGroupSizesExample {
protected readonly team = [
{ name: "Dewi Lestari" },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
}In a project card
Website redesign
Due Friday, 14 of 20 tasks done
Website redesign
Due Friday, 14 of 20 tasks done
Website redesign
Due Friday, 14 of 20 tasks done
Website redesign
Due Friday, 14 of 20 tasks done
Website redesign
Due Friday, 14 of 20 tasks done
@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'],
];
@endphp
<div class="rounded-xl border border-line bg-surface p-5">
<div class="flex items-start justify-between gap-4">
<div>
<h3 class="text-base font-semibold text-ink">Website redesign</h3>
<p class="mt-1 text-sm text-muted">Due Friday, 14 of 20 tasks done</p>
</div>
<span class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink">On track</span>
</div>
<div class="mt-6 flex items-center justify-between">
<x-markas.avatar-group :items="$team" size="sm" :max="3" group-label="Assignees" class="[--avatar-ring:var(--color-surface)]" />
<span class="text-sm font-medium text-ink">70%</span>
</div>
</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" },
];
export default function Example() {
return (
<div className="rounded-xl border border-line bg-surface p-5">
<div className="flex items-start justify-between gap-4">
<div>
<h3 className="text-base font-semibold text-ink">Website redesign</h3>
<p className="mt-1 text-sm text-muted">
Due Friday, 14 of 20 tasks done
</p>
</div>
<span className="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink">
On track
</span>
</div>
<div className="mt-6 flex items-center justify-between">
<AvatarGroup
items={team}
size="sm"
max={3}
groupLabel="Assignees"
className="[--avatar-ring:var(--color-surface)]"
/>
<span className="text-sm font-medium text-ink">70%</span>
</div>
</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" },
];
</script>
<template>
<div class="rounded-xl border border-line bg-surface p-5">
<div class="flex items-start justify-between gap-4">
<div>
<h3 class="text-base font-semibold text-ink">Website redesign</h3>
<p class="mt-1 text-sm text-muted">Due Friday, 14 of 20 tasks done</p>
</div>
<span
class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink"
>On track</span
>
</div>
<div class="mt-6 flex items-center justify-between">
<AvatarGroup
:items="team"
size="sm"
:max="3"
group-label="Assignees"
class="[--avatar-ring:var(--color-surface)]"
/>
<span class="text-sm font-medium text-ink">70%</span>
</div>
</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" },
];
</script>
<div class="rounded-xl border border-line bg-surface p-5">
<div class="flex items-start justify-between gap-4">
<div>
<h3 class="text-base font-semibold text-ink">Website redesign</h3>
<p class="mt-1 text-sm text-muted">Due Friday, 14 of 20 tasks done</p>
</div>
<span
class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink"
>On track</span
>
</div>
<div class="mt-6 flex items-center justify-between">
<AvatarGroup
items={team}
size="sm"
max={3}
groupLabel="Assignees"
class="[--avatar-ring:var(--color-surface)]"
/>
<span class="text-sm font-medium text-ink">70%</span>
</div>
</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" },
];
---
<div class="rounded-xl border border-line bg-surface p-5">
<div class="flex items-start justify-between gap-4">
<div>
<h3 class="text-base font-semibold text-ink">Website redesign</h3>
<p class="mt-1 text-sm text-muted">Due Friday, 14 of 20 tasks done</p>
</div>
<span
class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink"
>On track</span
>
</div>
<div class="mt-6 flex items-center justify-between">
<AvatarGroup
items={team}
size="sm"
max={3}
groupLabel="Assignees"
class="[--avatar-ring:var(--color-surface)]"
/>
<span class="text-sm font-medium text-ink">70%</span>
</div>
</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="rounded-xl border border-line bg-surface p-5">
<div class="flex items-start justify-between gap-4">
<div>
<h3 class="text-base font-semibold text-ink">Website redesign</h3>
<p class="mt-1 text-sm text-muted">Due Friday, 14 of 20 tasks done</p>
</div>
<span
class="rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-ink"
>On track</span
>
</div>
<div class="mt-6 flex items-center justify-between">
<div
markas-avatar-group
[items]="team"
size="sm"
[max]="3"
groupLabel="Assignees"
class="[--avatar-ring:var(--color-surface)]"
></div>
<span class="text-sm font-medium text-ink">70%</span>
</div>
</div>
`,
})
export default class AvatarGroupCardExample {
protected readonly team = [
{ name: "Dewi Lestari", src: photo },
{ name: "Budi Santoso" },
{ name: "Siti Aminah" },
{ name: "John Carter" },
{ name: "Maya Putri" },
];
}Liked by
MPMaya Putri
RHRizal Hakim
ALAna Lim
+33 moreJohn Carter, Siti Aminah, Budi Santoso
Maya Putri and 5 others liked this
MPMaya PutriRHRizal HakimALAna Lim+33 moreJohn Carter, Siti Aminah, Budi Santoso
Maya Putri and 5 others liked this
MPMaya PutriRHRizal HakimALAna Lim+33 moreJohn Carter, Siti Aminah, Budi Santoso
Maya Putri and 5 others liked this
MPMaya PutriRHRizal HakimALAna Lim +33 moreJohn Carter, Siti Aminah, Budi Santoso
Maya Putri and 5 others liked this
MPMaya PutriRHRizal HakimALAna Lim+33 moreJohn Carter, Siti Aminah, Budi Santoso
Maya Putri and 5 others liked this
@php
$people = [
['name' => 'Maya Putri'],
['name' => 'Rizal Hakim'],
['name' => 'Ana Lim'],
['name' => 'John Carter'],
['name' => 'Siti Aminah'],
['name' => 'Budi Santoso'],
];
@endphp
<div class="flex items-center gap-2 pt-8">
<x-markas.avatar-group :items="$people" size="sm" :max="3" group-label="Liked by" />
<p class="text-sm text-muted">
<span class="font-medium text-ink">Maya Putri</span> and 5 others liked this
</p>
</div>import { AvatarGroup } from "@/components/markas/AvatarGroup";
const people = [
{ name: "Maya Putri" },
{ name: "Rizal Hakim" },
{ name: "Ana Lim" },
{ name: "John Carter" },
{ name: "Siti Aminah" },
{ name: "Budi Santoso" },
];
export default function Example() {
return (
<div className="flex items-center gap-2 pt-8">
<AvatarGroup items={people} size="sm" max={3} groupLabel="Liked by" />
<p className="text-sm text-muted">
<span className="font-medium text-ink">Maya Putri</span> and 5 others
liked this
</p>
</div>
);
}<script setup lang="ts">
import AvatarGroup from "@/components/markas/AvatarGroup.vue";
const people = [
{ name: "Maya Putri" },
{ name: "Rizal Hakim" },
{ name: "Ana Lim" },
{ name: "John Carter" },
{ name: "Siti Aminah" },
{ name: "Budi Santoso" },
];
</script>
<template>
<div class="flex items-center gap-2 pt-8">
<AvatarGroup :items="people" size="sm" :max="3" group-label="Liked by" />
<p class="text-sm text-muted">
<span class="font-medium text-ink">Maya Putri</span> and 5 others liked
this
</p>
</div>
</template><script lang="ts">
import AvatarGroup from "$lib/components/markas/AvatarGroup.svelte";
const people = [
{ name: "Maya Putri" },
{ name: "Rizal Hakim" },
{ name: "Ana Lim" },
{ name: "John Carter" },
{ name: "Siti Aminah" },
{ name: "Budi Santoso" },
];
</script>
<div class="flex items-center gap-2 pt-8">
<AvatarGroup items={people} size="sm" max={3} groupLabel="Liked by" />
<p class="text-sm text-muted">
<span class="font-medium text-ink">Maya Putri</span> and 5 others liked this
</p>
</div>---
import AvatarGroup from "@/components/markas/AvatarGroup.astro";
const people = [
{ name: "Maya Putri" },
{ name: "Rizal Hakim" },
{ name: "Ana Lim" },
{ name: "John Carter" },
{ name: "Siti Aminah" },
{ name: "Budi Santoso" },
];
---
<div class="flex items-center gap-2 pt-8">
<AvatarGroup items={people} size="sm" max={3} groupLabel="Liked by" />
<p class="text-sm text-muted">
<span class="font-medium text-ink">Maya Putri</span> and 5 others liked this
</p>
</div>import { Component } from "@angular/core";
import { AvatarGroup } from "./markas/avatar-group.component";
@Component({
selector: "markas-example",
imports: [AvatarGroup],
template: `
<div class="flex items-center gap-2 pt-8">
<div
markas-avatar-group
[items]="people"
size="sm"
[max]="3"
groupLabel="Liked by"
></div>
<p class="text-sm text-muted">
<span class="font-medium text-ink">Maya Putri</span> and 5 others liked
this
</p>
</div>
`,
})
export default class AvatarGroupLikesExample {
protected readonly people = [
{ name: "Maya Putri" },
{ name: "Rizal Hakim" },
{ name: "Ana Lim" },
{ name: "John Carter" },
{ name: "Siti Aminah" },
{ name: "Budi Santoso" },
];
}Installation
npx markasui@latest add avatar-grouppnpm dlx markasui@latest add avatar-groupyarn dlx markasui@latest add avatar-groupbunx --bun markasui@latest add avatar-group- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
resources/views/components/markas/avatar-group.blade.php.
resources/views/components/markas/avatar-group.blade.php
@props([
'items' => [],
'max' => 4,
'size' => 'md',
'groupLabel' => 'Members',
'moreLabel' => '{count} more',
])
@php
$root = 'group/avatars isolate flex items-center';
$item = 'group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none';
$face = 'flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none';
$image = 'object-cover';
$fallback = 'bg-primary-soft text-primary';
$more = 'bg-subtle text-ink';
$tooltip = 'pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none';
$sizes = [
'sm' => 'size-8 text-xs',
'md' => 'size-10 text-sm',
'lg' => 'size-12 text-base',
];
$overlaps = [
'sm' => 'not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5',
'md' => 'not-first:-ml-2 group-hover/avatars:not-first:ml-1',
'lg' => 'not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5',
];
// Huruf pertama kata pertama dan terakhir, sama dengan getInitials() di versi React dan Vue.
$initials = function (string $name): string {
$words = preg_split('/\s+/u', trim($name), -1, PREG_SPLIT_NO_EMPTY) ?: [];
$pick = count($words) > 1 ? [$words[0], end($words)] : $words;
return mb_strtoupper(implode('', array_map(fn ($word) => mb_substr($word, 0, 1), $pick)));
};
$shown = array_slice($items, 0, $max);
$hidden = array_slice($items, $max);
$hiddenNames = implode(', ', array_map(fn ($person) => $person['name'], $hidden));
@endphp
<div role="group" aria-label="{{ $groupLabel }}" {{ $attributes->class([$root]) }}>
@foreach ($shown as $person)
<span class="{{ $item }} {{ $overlaps[$size] }}">@if (! empty($person['src']))<img src="{{ $person['src'] }}" alt="{{ $person['name'] }}" class="{{ $face }} {{ $image }} {{ $sizes[$size] }}" />@else<span role="img" aria-label="{{ $person['name'] }}" class="{{ $face }} {{ $fallback }} {{ $sizes[$size] }}">{{ $initials($person['name']) }}</span>@endif<span aria-hidden="true" class="{{ $tooltip }}">{{ $person['name'] }}</span></span>
@endforeach
@if (count($hidden) > 0)
<span class="{{ $item }} {{ $overlaps[$size] }}"><span class="{{ $face }} {{ $more }} {{ $sizes[$size] }}"><span aria-hidden="true">+{{ count($hidden) }}</span><span class="sr-only">{{ str_replace('{count}', (string) count($hidden), $moreLabel) }}</span></span><span aria-hidden="true" class="{{ $tooltip }}">{{ $hiddenNames }}</span></span>
@endif
</div>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/AvatarGroup.tsx.
src/components/markas/AvatarGroup.tsx
import type { ComponentProps } from "react";
const root = "group/avatars isolate flex items-center";
const item =
"group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none";
const face =
"flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none";
const image = "object-cover";
const fallback = "bg-primary-soft text-primary";
const more = "bg-subtle text-ink";
const tooltip =
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none";
const sizes = {
sm: "size-8 text-xs",
md: "size-10 text-sm",
lg: "size-12 text-base",
};
const overlaps = {
sm: "not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5",
md: "not-first:-ml-2 group-hover/avatars:not-first:ml-1",
lg: "not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5",
};
const cx = (...c: (string | false | null | undefined)[]) =>
c.filter(Boolean).join(" ");
/** Huruf pertama kata pertama dan terakhir, sama dengan versi Blade dan Vue. */
function getInitials(name: string): string {
const words = name.trim().split(/\s+/).filter(Boolean);
const picked = words.length > 1 ? [words[0], words[words.length - 1]] : words;
return picked
.map((word) => Array.from(word ?? "")[0] ?? "")
.join("")
.toUpperCase();
}
export type AvatarGroupItem = { name: string; src?: string | null };
export type AvatarGroupProps = ComponentProps<"div"> & {
items: AvatarGroupItem[];
max?: number;
size?: keyof typeof sizes;
groupLabel?: string;
moreLabel?: string;
};
export function AvatarGroup({
items,
max = 4,
size = "md",
groupLabel = "Members",
moreLabel = "{count} more",
className,
...props
}: AvatarGroupProps) {
const shown = items.slice(0, max);
const hidden = items.slice(max);
return (
<div
role="group"
aria-label={groupLabel}
{...props}
className={cx(root, className)}
>
{shown.map((person, index) => (
<span key={index} className={cx(item, overlaps[size])}>
{person.src ? (
<img
src={person.src}
alt={person.name}
className={cx(face, image, sizes[size])}
/>
) : (
<span
role="img"
aria-label={person.name}
className={cx(face, fallback, sizes[size])}
>
{getInitials(person.name)}
</span>
)}
<span aria-hidden="true" className={tooltip}>
{person.name}
</span>
</span>
))}
{hidden.length > 0 && (
<span className={cx(item, overlaps[size])}>
<span className={cx(face, more, sizes[size])}>
<span aria-hidden="true">+{hidden.length}</span>
<span className="sr-only">
{moreLabel.replace("{count}", String(hidden.length))}
</span>
</span>
<span aria-hidden="true" className={tooltip}>
{hidden.map((person) => person.name).join(", ")}
</span>
</span>
)}
</div>
);
}- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/AvatarGroup.vue.
src/components/markas/AvatarGroup.vue
<script setup lang="ts">
import { computed } from "vue";
type Size = "sm" | "md" | "lg";
export type AvatarGroupItem = { name: string; src?: string | null };
const props = withDefaults(
defineProps<{
items: AvatarGroupItem[];
max?: number;
size?: Size;
groupLabel?: string;
moreLabel?: string;
}>(),
{ max: 4, size: "md", groupLabel: "Members", moreLabel: "{count} more" },
);
const root = "group/avatars isolate flex items-center";
const item =
"group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none";
const face =
"flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none";
const image = "object-cover";
const fallback = "bg-primary-soft text-primary";
const more = "bg-subtle text-ink";
const tooltip =
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none";
const sizes = {
sm: "size-8 text-xs",
md: "size-10 text-sm",
lg: "size-12 text-base",
};
const overlaps = {
sm: "not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5",
md: "not-first:-ml-2 group-hover/avatars:not-first:ml-1",
lg: "not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5",
};
/** Huruf pertama kata pertama dan terakhir, sama dengan versi Blade dan React. */
function getInitials(name: string): string {
const words = name.trim().split(/\s+/).filter(Boolean);
const picked = words.length > 1 ? [words[0], words[words.length - 1]] : words;
return picked
.map((word) => Array.from(word ?? "")[0] ?? "")
.join("")
.toUpperCase();
}
const shown = computed(() => props.items.slice(0, props.max));
const hidden = computed(() => props.items.slice(props.max));
const hiddenNames = computed(() =>
hidden.value.map((person) => person.name).join(", "),
);
const moreText = computed(() =>
props.moreLabel.replace("{count}", String(hidden.value.length)),
);
</script>
<template>
<div role="group" :aria-label="props.groupLabel" :class="root">
<span
v-for="(person, index) in shown"
:key="index"
:class="[item, overlaps[props.size]]"
>
<img
v-if="person.src"
:src="person.src"
:alt="person.name"
:class="[face, image, sizes[props.size]]"
/>
<span
v-else
role="img"
:aria-label="person.name"
:class="[face, fallback, sizes[props.size]]"
>{{ getInitials(person.name) }}</span
>
<span aria-hidden="true" :class="tooltip">{{ person.name }}</span>
</span>
<span v-if="hidden.length > 0" :class="[item, overlaps[props.size]]">
<span :class="[face, more, sizes[props.size]]"
><span aria-hidden="true">+{{ hidden.length }}</span
><span class="sr-only">{{ moreText }}</span></span
>
<span aria-hidden="true" :class="tooltip">{{ hiddenNames }}</span>
</span>
</div>
</template>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/AvatarGroup.svelte.
src/lib/components/markas/AvatarGroup.svelte
<script lang="ts" module>
export type AvatarGroupItem = { name: string; src?: string | null };
</script>
<script lang="ts">
import type { HTMLAttributes } from "svelte/elements";
const root = "group/avatars isolate flex items-center";
const item =
"group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none";
const face =
"flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none";
const image = "object-cover";
const fallback = "bg-primary-soft text-primary";
const more = "bg-subtle text-ink";
const tooltip =
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none";
const sizes = {
sm: "size-8 text-xs",
md: "size-10 text-sm",
lg: "size-12 text-base",
};
const overlaps = {
sm: "not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5",
md: "not-first:-ml-2 group-hover/avatars:not-first:ml-1",
lg: "not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5",
};
/** First letter of the first and last word, same as the Blade, React, and Vue versions. */
function getInitials(name: string): string {
const words = name.trim().split(/\s+/).filter(Boolean);
const picked =
words.length > 1 ? [words[0], words[words.length - 1]] : words;
return picked
.map((word) => Array.from(word ?? "")[0] ?? "")
.join("")
.toUpperCase();
}
type Props = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
items: AvatarGroupItem[];
max?: number;
size?: keyof typeof sizes;
/** Accessible name of the group. */
groupLabel?: string;
/** Hidden text on the +N chip. {count} is replaced with the number of hidden people. */
moreLabel?: string;
};
let {
items,
max = 4,
size = "md",
groupLabel = "Members",
moreLabel = "{count} more",
class: className,
...rest
}: Props = $props();
const shown = $derived(items.slice(0, max));
const hidden = $derived(items.slice(max));
</script>
<div role="group" aria-label={groupLabel} {...rest} class={[root, className]}>
{#each shown as person, index (index)}
<span class={[item, overlaps[size]]}
>{#if person.src}<img
src={person.src}
alt={person.name}
class={[face, image, sizes[size]]}
/>{:else}<span
role="img"
aria-label={person.name}
class={[face, fallback, sizes[size]]}>{getInitials(person.name)}</span
>{/if}<span aria-hidden="true" class={tooltip}>{person.name}</span
></span
>
{/each}
{#if hidden.length > 0}
<span class={[item, overlaps[size]]}
><span class={[face, more, sizes[size]]}
><span aria-hidden="true">+{hidden.length}</span><span class="sr-only"
>{moreLabel.replace("{count}", String(hidden.length))}</span
></span
><span aria-hidden="true" class={tooltip}
>{hidden.map((person) => person.name).join(", ")}</span
></span
>
{/if}
</div>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/AvatarGroup.astro.
src/components/markas/AvatarGroup.astro
---
import type { HTMLAttributes } from "astro/types";
const root = "group/avatars isolate flex items-center";
const item =
"group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none";
const face =
"flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none";
const image = "object-cover";
const fallback = "bg-primary-soft text-primary";
const more = "bg-subtle text-ink";
const tooltip =
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none";
const sizes = {
sm: "size-8 text-xs",
md: "size-10 text-sm",
lg: "size-12 text-base",
};
const overlaps = {
sm: "not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5",
md: "not-first:-ml-2 group-hover/avatars:not-first:ml-1",
lg: "not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5",
};
/** First letter of the first and last word, same as the Blade, React, and Vue versions. */
function getInitials(name: string): string {
const words = name.trim().split(/\s+/).filter(Boolean);
const picked = words.length > 1 ? [words[0], words[words.length - 1]] : words;
return picked
.map((word) => Array.from(word ?? "")[0] ?? "")
.join("")
.toUpperCase();
}
export type AvatarGroupItem = { name: string; src?: string | null };
type Props = HTMLAttributes<"div"> & {
items: AvatarGroupItem[];
max?: number;
size?: keyof typeof sizes;
/** Accessible name of the group. */
groupLabel?: string;
/** Hidden text on the +N chip. {count} is replaced with the number of hidden people. */
moreLabel?: string;
};
const {
items,
max = 4,
size = "md",
groupLabel = "Members",
moreLabel = "{count} more",
class: className,
...rest
} = Astro.props;
const shown = items.slice(0, max);
const hidden = items.slice(max);
---
<div role="group" aria-label={groupLabel} {...rest} class:list={[root, className]}>
{
shown.map((person) => (
<span class:list={[item, overlaps[size]]}>
{person.src ? (
<img src={person.src} alt={person.name} class:list={[face, image, sizes[size]]} />
) : (
<span role="img" aria-label={person.name} class:list={[face, fallback, sizes[size]]}>
{getInitials(person.name)}
</span>
)}
<span aria-hidden="true" class={tooltip}>{person.name}</span>
</span>
))
}
{
hidden.length > 0 && (
<span class:list={[item, overlaps[size]]}>
<span class:list={[face, more, sizes[size]]}>
<span aria-hidden="true">+{hidden.length}</span>
<span class="sr-only">{moreLabel.replace("{count}", String(hidden.length))}</span>
</span>
<span aria-hidden="true" class={tooltip}>
{hidden.map((person) => person.name).join(", ")}
</span>
</span>
)
}
</div>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/avatar-group.component.ts.
src/app/markas/avatar-group.component.ts
import {
ChangeDetectionStrategy,
Component,
computed,
input,
} from "@angular/core";
const root = "group/avatars isolate flex items-center";
const item =
"group/avatar relative shrink-0 transition-[margin] duration-200 ease-out hover:z-10 motion-reduce:transition-none";
const face =
"flex items-center justify-center overflow-hidden rounded-full font-medium ring-2 ring-[var(--avatar-ring,var(--color-canvas))] transition-[translate,scale] duration-200 ease-out select-none group-hover/avatar:-translate-y-1 group-hover/avatar:scale-110 motion-reduce:transition-none";
const image = "object-cover";
const fallback = "bg-primary-soft text-primary";
const more = "bg-subtle text-ink";
const tooltip =
"pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 translate-y-1 rounded-md bg-ink px-2 py-1 text-xs font-medium whitespace-nowrap text-canvas opacity-0 shadow-overlay transition duration-150 ease-out group-hover/avatar:translate-y-0 group-hover/avatar:opacity-100 motion-reduce:transition-none";
const sizes = {
sm: "size-8 text-xs",
md: "size-10 text-sm",
lg: "size-12 text-base",
};
const overlaps = {
sm: "not-first:-ml-1.5 group-hover/avatars:not-first:ml-0.5",
md: "not-first:-ml-2 group-hover/avatars:not-first:ml-1",
lg: "not-first:-ml-2.5 group-hover/avatars:not-first:ml-1.5",
};
/** First letter of the first and last word, same as the Blade, React, and Vue versions. */
function getInitials(name: string): string {
const words = name.trim().split(/\s+/).filter(Boolean);
const picked = words.length > 1 ? [words[0], words[words.length - 1]] : words;
return picked
.map((word) => Array.from(word ?? "")[0] ?? "")
.join("")
.toUpperCase();
}
export type AvatarGroupItem = { name: string; src?: string | null };
export type AvatarGroupSize = keyof typeof sizes;
/** Attribute selector on the group div: aria-label, class, and other attributes stay on it. */
@Component({
selector: "div[markas-avatar-group]",
changeDetection: ChangeDetectionStrategy.OnPush,
host: {
role: "group",
"[attr.aria-label]": "groupLabel()",
"[class]": "root",
},
template: `
@for (person of shown(); track $index) {
<span [class]="itemClasses()">
@if (person.src) {
<img
[src]="person.src"
[alt]="person.name"
[class]="imageClasses()"
/>
} @else {
<span
role="img"
[attr.aria-label]="person.name"
[class]="fallbackClasses()"
>{{ initials(person.name) }}</span
>
}
<span aria-hidden="true" [class]="tooltip">{{
person.name
}}</span></span
>
}
@if (hidden().length > 0) {
<span [class]="itemClasses()"
><span [class]="moreClasses()"
><span aria-hidden="true">+{{ hidden().length }}</span
><span class="sr-only">{{ moreText() }}</span></span
><span aria-hidden="true" [class]="tooltip">{{
hiddenNames()
}}</span></span
>
}
`,
})
export class AvatarGroup {
readonly items = input.required<AvatarGroupItem[]>();
readonly max = input(4);
readonly size = input<AvatarGroupSize>("md");
/** Accessible name of the group. */
readonly groupLabel = input("Members");
/** Hidden text on the +N chip. {count} is replaced with the number of hidden people. */
readonly moreLabel = input("{count} more");
protected readonly root = root;
protected readonly tooltip = tooltip;
protected readonly initials = getInitials;
protected readonly shown = computed(() => this.items().slice(0, this.max()));
protected readonly hidden = computed(() => this.items().slice(this.max()));
protected readonly hiddenNames = computed(() =>
this.hidden()
.map((person) => person.name)
.join(", "),
);
protected readonly moreText = computed(() =>
this.moreLabel().replace("{count}", String(this.hidden().length)),
);
protected readonly itemClasses = computed(
() => `${item} ${overlaps[this.size()]}`,
);
protected readonly imageClasses = computed(
() => `${face} ${image} ${sizes[this.size()]}`,
);
protected readonly fallbackClasses = computed(
() => `${face} ${fallback} ${sizes[this.size()]}`,
);
protected readonly moreClasses = computed(
() => `${face} ${more} ${sizes[this.size()]}`,
);
}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
maxcollapse into a +N chip. Its tooltip lists their names and screen readers hearmoreLabel(“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
| Name | Type | Default | Description |
|---|---|---|---|
items | { name: string; src?: string }[] | [] | People in the group. Without src, the initials of name are shown. |
max | number | 4 | Number of avatars shown before the rest collapse into a +N chip. |
size | 'sm' | 'md' | 'lg' | md | Avatar size of 32, 40, or 48 pixels. The overlap scales with it. |
groupLabel | string | Members | Accessible name of the group, such as "Project members". |
moreLabel | string | {count} more | Hidden 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.
- Letter SwapText whose letters slide out and back in with a stagger when its link or button is hovered or focused. Forward, ping-pong, or shuffled order.
- MarqueeEndless horizontal or vertical scroll of any content, with faded edges, reverse direction, and a pause on hover or focus.
- Number TickerNumber that counts up to its value when it scrolls into view, with thousands separators, decimals, and a prefix or suffix.
- Scroll ProgressThin bar at the top of the page or a scrolling container that fills as the reader scrolls.
- Spotlight CardCard with a soft radial light that follows the pointer and a border that glows near it. Lights up on keyboard focus too.
- Text HighlighterA highlight that draws behind inline text from four directions: in view, on hover or focus, on mount, or on command. Solid, marker, underline, or gradient.