Components
Avatar group
A compact stack of avatars with an overflow count and presence.
Free
pnpm dlx shadcn@latest add @caliper/avatar-groupWhen to use
Use it for
- Showing who is on a project or in a conversation.
- Space is tight.
Skip it when
- Names matter more than faces; list them.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/avatar-group
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
This is the code behind the preview above.
example.tsx
import { useState, type ReactNode } from "react" import { AvatarGroup } from "@/components/ui/avatar-group" import { Button } from "@/components/ui/button" import { cn } from "@/components/ui/lib/cn" function Panel({ title, context, media, action, className, children }: { title: string; context: string; media?: ReactNode; action?: ReactNode; className?: string; children?: ReactNode }) { return ( <section className={cn("grid w-full max-w-md gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting", className)}> <div className="flex items-center gap-3"> {media} <div className="grid min-w-0 flex-1 gap-1"> <p className="font-medium">{title}</p> <p className="text-sm text-muted-foreground">{context}</p> </div> {action} </div> {children} </section> ); } const team = [ { name: "Mara Chen", status: "online" as const }, { name: "Noor Haddad" }, { name: "Ivo Petrov", status: "online" as const }, { name: "Sana Okafor" }, { name: "Tomas Ferreira" }, ]; export function ProjectTeam() { const [members, setMembers] = useState(team); const added = members.length > team.length; return ( <Panel title="Harbour redesign" context={`${members.length} people · 2 online now`}> <div className="flex items-center justify-between gap-3"> <AvatarGroup label="Project team" max={3} members={members} /> <Button variant="secondary" size="sm" onClick={() => setMembers(added ? team : [...team, { name: "Elias Kim", status: "online" }])}> {added ? "Remove Elias Kim" : "Add Elias Kim"} </Button> </div> </Panel> ); }
API reference
AvatarGroup
component
PropTypeDefault
members *readonly AvatarGroupMember[]—
maxnumber4
labelstring"Team members"
classNamestring—
Accessibility
It exposes group and img semantics, with aria-label and aria-hidden kept in step with state.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.