Join our Discord community
Media

Avatar Group

Versatile avatar group component with motion, CSS, and stack variants. Features tooltips, hover effects, and flexible positioning for React applications with Next.js integration and TypeScript support.

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/avatar-group.json
npx shadcn@latest add https://www.shadcn.io/registry/avatar-group.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/avatar-group.json
bunx shadcn@latest add https://www.shadcn.io/registry/avatar-group.json

Features

  • Multiple variants including motion-based, CSS-only, and stack layouts
  • Spring animations with hover effects using customizable motion transitions
  • Tooltip integration with shadcn/ui tooltip components and configurable positioning
  • Z-index management with automatic layering and optional overlap inversion
  • Flexible positioning with customizable translate values and spring physics
  • TypeScript support with complete interface definitions and variant types
  • shadcn/ui integration using design system avatar components and spacing utilities
  • Responsive design that works across device sizes with touch-friendly interactions

Examples

CSS Variant

Loading component...

A sleek, CSS-only avatar group using TailwindCSS for the translate animation with hover effects.

Stack Variant

Loading component...

Classic stacked avatar layout with mask overlay effects for a clean, layered appearance.

Stack Animated

Loading component...

Enhanced stack variant with hover animations that expand the spacing between avatars.

Bottom Tooltips

Loading component...

Avatar group with tooltips positioned at the bottom and inverted overlap order.

Use Cases

This free open source React component works well for:

  • Team displays - Show team members or collaborators built with Next.js
  • User lists - Display active users or participants using TypeScript and Tailwind CSS
  • Social features - Friend lists and community members with shadcn/ui integration
  • Collaboration tools - Show who's working on projects for React applications
  • Comment sections - Display comment authors with animated interactions

API Reference

AvatarGroup

PropTypeDefaultDescription
childrenReact.ReactElement[]requiredArray of Avatar components to display
variant'motion' | 'css' | 'stack''motion'Display variant for the avatar group
transitionTransition{ type: 'spring', stiffness: 300, damping: 17 }Motion transition configuration (motion variant only)
invertOverlapbooleanfalseReverse z-index stacking order
translatestring | number'-30%'Hover translate distance (motion/css variants)
tooltipPropsTooltipProps{ side: 'top', sideOffset: 24 }Tooltip positioning and behavior
animatebooleanfalseEnable hover spacing animation (stack variant only)
sizenumber40Avatar size in pixels (stack variant only)
classNamestring-Additional CSS classes for container

AvatarGroupTooltip

PropTypeDefaultDescription
childrenReact.ReactNoderequiredTooltip content to display

Variants

Motion Variant

Uses Framer Motion for smooth spring-based hover animations with customizable physics.

<AvatarGroup variant="motion" transition={{ type: 'spring', stiffness: 400 }}>
  {/* Avatar components */}
</AvatarGroup>

CSS Variant

Pure CSS hover effects with TailwindCSS transitions for lightweight performance.

<AvatarGroup variant="css">
  {/* Avatar components */}
</AvatarGroup>

Stack Variant

Traditional stacked layout with mask overlay effects and optional hover animations.

<AvatarGroup variant="stack" animate size={48}>
  {/* Avatar components */}
</AvatarGroup>

Motion Configuration

transition?: {
  type?: 'spring' | 'tween';
  stiffness?: number;        // Spring stiffness (default: 300)
  damping?: number;          // Spring damping (default: 17)
  duration?: number;         // Animation duration
  ease?: string | number[];  // Easing function
}

Tooltip Props

tooltipProps?: {
  side?: 'top' | 'right' | 'bottom' | 'left';
  sideOffset?: number;
  align?: 'start' | 'center' | 'end';
  openDelay?: number;
  closeDelay?: number;
}

Implementation Notes

  • Motion variant: Uses Framer Motion for smooth hover animations with spring physics
  • CSS variant: Uses TailwindCSS transitions for lightweight hover effects
  • Stack variant: Uses CSS mask properties for clean overlay effects
  • Integrates with shadcn/ui tooltip system for consistent behavior
  • Automatically manages z-index stacking for proper avatar layering
  • Supports both percentage and pixel values for translate distances
  • Works with any shadcn/ui Avatar component configuration
  • TooltipProvider handles timing and interaction behavior (motion/css variants only)
  • Hover effects trigger on both hover and tap for touch devices
  • Compatible with custom avatar sizes and border configurations
  • Integrates seamlessly with shadcn/ui design system patterns