Skip to Content
zjkm-ui
Components

Avatar Stack

Stacked avatars with names on hover.

  • AL
  • AT
  • GH
  • KJ
  • LT
  • +2
Props
5
<AvatarStack people={people} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/avatar-tooltip.json
import { AvatarStack } from "@/components/avatar-tooltip"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

Overlapping avatars, each lifting and showing its name on hover, with "+N" for anyone past max. Every avatar is an image named after its person, so screen readers read the whole list.

import { AvatarStack } from "@/components/avatar-tooltip";

const people = [
  { name: "Ada Lovelace", src: "/ada.jpg" },
  { name: "Alan Turing", color: "#0369a1" },
];

export function Collaborators() {
  return <AvatarStack label="Editing now" people={people} />;
}

Props

PropTypeDefaultDescription
people{ name, src?, color? }[]The people. Without a photo, initials are shown.
maxnumber5Shown before "+N".
sizenumber36Avatar size in pixels.
labelstring"People"Accessible name of the list.
classNamestringClasses for the list.

With reduced motion, avatars don't lift on hover.

On this page