Avatar Group

Overlapping faces with a +3 that opens everyone, for reviewers, editors and members.

Retry failed card payments7 reviewers · 3 approved
MP

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/avatar-group

Usage

import { type AvatarPerson, AvatarGroup } from "./ui/uicontext/components/Avatar.ts"
export const Reviewers = <M>(h: Html.H<M>, reviewers: ReadonlyArray<AvatarPerson>) =>	AvatarGroup(h, { props: { label: "Reviewers", people: reviewers, max: 4 } })

Examples

Edge cases

One person, names that break layouts and a picture that fails to load, a workspace of 1,284 whose list shows the first 50, and a count with no list.

One person
Hard names
AWCMJF王
1,284 members
ALBLMLSL
Count only
ALBL+16

API reference

AvatarGroupComponent

Props

AvatarGroup props
NameTypeDefaultDescription
peoplerequiredAvatarPerson[]—Who's in it, in the order they show.
labelrequiredstring—What the group is: "Reviewers", "In this doc". It names the group and heads the list.
maxnumber4How many tiles show, the "+N" counted as one; 4 by default.
sizeAvatarSize——
staticboolean—The "+N" only counts, with no list to open: for a crowded row where the list lives elsewhere.

AvatarView function

Options

Avatar options
NameTypeDefaultDescription
keystring—Names this avatar among others in the same view; needed for more than one with a picture.
size"xs" | "sm" | "md" | "lg" | "xl"sm20, 24, 32, 40 or 64px; sm by default.
decorativeboolean—Leave the avatar out of the accessibility tree, when its name is already written beside it.
styleStyle—StyleX styles applied after the avatar's own.

Source