Avatar Group
Tumpukan avatar yang mengembang saat hover, menampilkan nama di tooltip, dan meringkas sisa orang menjadi chip +N.
@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" },
];
}Contoh
Ukuran
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" },
];
}Dalam kartu proyek
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" },
];
}Disukai oleh
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" },
];
}Instalasi
npx markasui@latest add avatar-grouppnpm dlx markasui@latest add avatar-groupyarn dlx markasui@latest add avatar-groupbunx --bun markasui@latest add avatar-group- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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>
);
}- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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>- Pastikan Tailwind CSS v4 dan markas.css sudah terpasang. Lihat Instalasi.
- Salin source komponen di bawah ini ke
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()]}`,
);
}Pemakaian
<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="Anggota proyek"
more-label="{count} lainnya"
/>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="Anggota proyek"
moreLabel="{count} lainnya"
/>;<template>
<AvatarGroup
:items="team"
:max="3"
group-label="Anggota proyek"
more-label="{count} lainnya"
/>
</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" }];
}- Tanpa JavaScript. Versi Blade tidak butuh Alpine.js; efek hover murni CSS.
- Orang setelah
maxdiringkas menjadi chip +N. Tooltip-nya berisi nama mereka dan screen reader membacamoreLabel(“2 lainnya”). - Ring di antara avatar memakai warna canvas. Di atas kartu, isi
class="[--avatar-ring:var(--color-surface)]". - Tooltip muncul di atas grup, jadi sisakan ruang di sana.
Props
| Nama | Tipe | Default | Keterangan |
|---|---|---|---|
items | { name: string; src?: string }[] | [] | Orang di dalam grup. Tanpa src, inisial name yang tampil. |
max | number | 4 | Jumlah avatar yang tampil sebelum sisanya diringkas menjadi chip +N. |
size | 'sm' | 'md' | 'lg' | md | Ukuran avatar 32, 40, atau 48 piksel. Tumpukan ikut menyesuaikan. |
groupLabel | string | Members | Nama aksesibel grup, misalnya "Anggota proyek". |
moreLabel | string | {count} more | Teks tersembunyi di chip +N untuk screen reader. {count} diganti jumlah orang yang tersembunyi. |
Aksesibilitas
- Tumpukan berupa group dengan nama aksesibel dari groupLabel.
- Setiap avatar adalah gambar bernama orang itu (alt atau role img dengan aria-label), jadi screen reader tidak butuh tooltip.
- Tooltip dan +N yang terlihat memakai aria-hidden; chip membacakan moreLabel.
- Dengan reduced motion, efek mengembang dan terangkat terjadi seketika tanpa transisi.
Komponen terkait
Komponen animasi lain dengan class yang sama di setiap framework.
- Letter SwapTeks yang hurufnya bergeser keluar lalu masuk lagi berurutan saat link atau tombolnya di-hover atau difokus. Urutan maju, bolak-balik, atau acak.
- MarqueeKonten apa pun yang bergulir tanpa henti secara horizontal atau vertikal, dengan tepi memudar, arah terbalik, dan jeda saat hover atau fokus.
- Number TickerAngka yang berhitung naik ke nilainya saat masuk layar, dengan pemisah ribuan, desimal, serta prefix atau suffix.
- Scroll ProgressBar tipis di atas halaman atau kontainer bergulir yang terisi seiring pembaca menggulir.
- Spotlight CardKartu dengan sorotan radial lembut yang mengikuti kursor dan border yang menyala di dekatnya. Ikut menyala saat fokus keyboard.
- Text HighlighterSorotan di balik teks inline yang tergambar dari empat arah: saat masuk layar, hover atau fokus, mount, atau perintah. Solid, stabilo, garis bawah, gradien.