Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by imskyleen
Edit on GitHub

Avatar Group

An animated avatar group that displays overlapping user images and smoothly shifts each avatar forward on hover to highlight it.

Powered by

Installation

bash
npx shadcn@latest add @redpanda/avatar-group
bash
pnpm dlx shadcn@latest add @redpanda/avatar-group
bash
yarn dlx shadcn@latest add @redpanda/avatar-group
bash
bunx shadcn@latest add @redpanda/avatar-group
bash
nubx shadcn@latest add @redpanda/avatar-group
bash
aube dlx shadcn@latest add @redpanda/avatar-group

AvatarGroup

An animated avatar group built with TailwindCSS and Motion, where avatars gently shift forward on hover to highlight each user.

Installation

Usage

tsx
const people = [  {    id: 'user-ben',    src: 'https://avatars.githubusercontent.com/u/9860550?v=4',    name: 'Beniamin Malinski',    initials: 'BM',  },  {    id: 'user-blair',    src: 'https://avatars.githubusercontent.com/u/23467862?v=4',    name: 'Blair McKee',    initials: 'BM',  },];
<AvatarGroup  items={people.map((person) => ({    id: person.id,    content: (      <Avatar>        <AvatarImage alt={person.name} src={person.src} />        <AvatarFallback>{person.initials}</AvatarFallback>        <AvatarGroupTooltip>{person.name}</AvatarGroupTooltip>      </Avatar>    ),  }))}/>;

Use overlap="tight" for the shared compact-overlap recipe and Avatar frame="group" for the owned separator around each overlapping image. Keep avatar dimensions explicit; no local negative-spacing or border paint is needed. This animated AvatarGroup is separate from the static AvatarGroup exported by avatar; its item API and motion/tooltip behavior are unchanged.

Each item requires a nonempty, unique domain id and one React element in content. IDs survive insertion, removal, and reordering; do not derive them from an array index or mutable display text. Changing an ID deliberately starts a new mounted item. JSX children are no longer accepted.

When to use

Use AvatarGroup to display multiple users in a compact, visually appealing way with interactive hover effects:

Use AvatarGroup when:

  • Showing team members or project collaborators
  • Displaying recent activity participants
  • Building user lists with limited space
  • Creating interactive user showcases
  • Indicating multiple users in shared contexts

Don’t use AvatarGroup when:

  • Showing a single user (use Avatar instead)
  • Building full user directories (use a proper list layout)
  • Displaying users that don’t have relationships
  • The avatars don’t need overlapping or hover effects

Anatomy

The AvatarGroup component creates an overlapping layout with interactive hover animations:

plaintext
AvatarGroup Container┌─────────────────────────────────────────────────────────────────┐│ TooltipProvider (hover delay management)                       ││ ┌─────────────────────────────────────────────────────────────┐ ││ │ Group Container (flex, -space-x-2)                         │ ││ │ ┌──────┐  ┌──────┐  ┌──────┐  ┌──────┐                     │ ││ │ │Avatar│  │Avatar│  │Avatar│  │Avatar│                     │ ││ │ │  1   │  │  2   │  │  3   │  │  4   │                     │ ││ │ │z-1   │  │z-2   │  │z-3   │  │z-4   │                     │ ││ │ └──────┘  └──────┘  └──────┘  └──────┘                     │ ││ │     ↑         ↑         ↑         ↑                        │ ││ │   On hover: translates up (-30% by default)                │ ││ └─────────────────────────────────────────────────────────────┘ │└─────────────────────────────────────────────────────────────────┘
Hover Behavior:- Mouse enters avatar → Avatar moves up with spring animation- Tooltip appears above the moved avatar- Mouse leaves → Avatar returns to original position- Tooltip disappears

Component Hierarchy:

  1. AvatarGroup (Root): Container managing layout and animation settings
  2. TooltipProvider: Manages tooltip delay and interactions
  3. AvatarContainer: Individual wrapper for each avatar with hover logic
  4. Avatar: The actual avatar component (image + fallback)
  5. AvatarGroupTooltip: Tooltip content shown on hover

Key Features:

  • Overlapping Layout: Uses negative margin (-space-x-2) for overlap
  • Z-Index Management: Each avatar has increasing z-index for proper stacking
  • Hover Animation: Spring-based upward translation on hover
  • Tooltip Integration: Built-in tooltip system with customizable content
  • Responsive: Adapts to different avatar sizes

Animation Properties:

  • Default Transition: Spring animation (stiffness: 400, damping: 30)
  • Default Translate: -30% upward movement
  • Hover States: Smooth enter/exit animations
  • Touch Support: The motion treatment responds to tap. Keep user names available through avatar image alt text; the visual tooltip is supplementary.
  • Feature ownership: The group supplies its own synchronous, non-strict LazyMotion animation features. No app-level provider is required; item content can still use full Motion components.

Examples

Bottom translation

Props

AvatarGroup

PropType
itemsreadonly AvatarGroupItem[]

Ordered items with unique stable IDs and avatar element content

Typereadonly AvatarGroupItem[]
overlap?'standard' | 'tight'

Standard 8px overlap or tight 12px overlap for the overlapping identity row

Type'standard' | 'tight'
Defaultstandard
className?string

The className of the avatar group

Typestring
transition?Transition

The transition of the avatar group

TypeTransition
Default{ type: 'spring', stiffness: 400, damping: 30 }
invertOverlap?boolean

By default, the avatar group is rendered in the same z-index as the avatars. This prop allows you to invert the z-index of the avatar group.

Typeboolean
translate?string | number

The translate y of the avatar group

Typestring | number
Default-30%
tooltipProps?Omit<TooltipContentProps, 'children'>

The props to pass to the tooltip

TypeOmit<TooltipContentProps, 'children'>
Default{ side: 'top', sideOffset: 24 }

AvatarGroupTooltip

PropType
childrenReact.ReactNode

The children of the avatar group tooltip

TypeReact.ReactNode

Credits

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?