Skip to content
Haze UI

Avatar group

Overlapping row of avatars that collapses extra people into a "+N" chip after a chosen limit.

pnpm dlx shadcn@latest add @haze/avatar-group
Open preview in a new tab
Liveno JavaScript

When to use

  • Showing who is on a project, a document or a meeting in a small space
  • Teams of unknown size, where only the first few faces fit
  • Cards and table rows that need a compact member list

When not to use

  • Readers need every name in view; list the people instead
  • A single person; use avatar

Installation

Add the Haze registry to components.json once, then install Avatar group with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/avatar-group
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
people*{ name: string; src?: string }[]–People in order; each avatar shows the initials of its name, or the photo when src is set.
maxnumber4Avatars shown before the overflow chip.
size"sm" | "md" | "lg""md"Passed to every avatar and to the chip.
labelstring–Accessible name of the group; defaults to a member count such as "5 members".
moreLabelstring"more"Screen-reader word after the overflow count, so "+4" is read as "4 more". Translate it for other languages.
classstring–Extra classes on the group.

Accessibility

  • The group has role="group" and a label with the full count, so the total is known even when the chip hides most names.
  • Each avatar is announced by its full name and the chip as "3 more" (or the moreLabel you pass); the initials alone are never the only text.
  • The ring in the page background keeps overlapping avatars distinct without relying on their fill colors.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Avatar group" with `npx shadcn@latest add @haze/avatar-group`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AvatarGroup from "@/components/haze/ui/avatar-group.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/avatar-group.md

  • Customize with real content

    Adapt the Haze avatar-group ui for our product. Replace the demo values of these props with our real content: people, max, size, label, moreLabel, class. Keep the layout, the heading level rules and these accessibility details: The group has role="group" and a label with the full count, so the total is known even when the chip hides most names. Each avatar is announced by its full name and the chip as "3 more" (or the moreLabel you pass); the initials alone are never the only text. The ring in the page background keeps overlapping avatars distinct without relying on their fill colors. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using avatar-group, check it fits: use it when showing who is on a project, a document or a meeting in a small space; teams of unknown size, where only the first few faces fit; cards and table rows that need a compact member list. Avoid it when readers need every name in view; list the people instead; a single person; use avatar. Alternatives: @haze/avatar, @haze/tag, @haze/item.

Dependencies

  • @haze/avatar
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog