AvatarStack

AvatarStack is an animated avatar stack component for React Native and React, from the dissolve library. Overlapping avatars with a +N chip: hover or hold to spread them with names, adding or removing one animates the stack.

Overlapping avatars with a +N chip for the rest, each ringed in the background color so the overlap reads cleanly; a person without an image shows their initials. Hover the stack and it spreads apart on a spring, with a tooltip that slides from avatar to avatar naming the one under the pointer, which lifts a little. On touch, press and hold then slide your finger across, or tap: the tap names the avatar under the finger and the stack closes up again on its own. With the keyboard, focus spreads it and the arrow keys move the name. Add or remove a person and the stack makes room or closes the gap, the newcomer popping in from a smaller size, the leaver shrinking away, the chip counting the rest. A selection tick as the name changes. Reduced motion: no springs, plain fades.

Install

React Native

Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:

npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
npx dissolve-ui add avatar-stack --native
npx shadcn@latest add https://dissolve.rselmi.com/r/native/avatar-stack.json

React

Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.

npx dissolve-ui add avatar-stack --web
npx shadcn@latest add https://dissolve.rselmi.com/r/avatar-stack.json

Usage

AvatarStack.tsx (React Native)
import { AvatarStack } from '@/components/dissolve/avatar-stack';

<AvatarStack
  avatars={[
    { id: 'ava', name: 'Ava Chen', src: 'https://example.com/ava.jpg' },
    { id: 'ben', name: 'Ben Ortiz' },
    { id: 'chloe', name: 'Chloe Martin', src: chloe },
  ]}
/>

// Three faces then the chip, smaller and tighter.
<AvatarStack avatars={team} max={3} size="sm" overlap={0.4} />
AvatarStack.tsx (React)
import { AvatarStack } from '@/components/dissolve/avatar-stack';

<AvatarStack
  avatars={[
    { id: 'ava', name: 'Ava Chen', src: 'https://example.com/ava.jpg' },
    { id: 'ben', name: 'Ben Ortiz' },
    { id: 'chloe', name: 'Chloe Martin', src: chloe },
  ]}
/>

// Three faces then the chip, smaller and tighter.
<AvatarStack avatars={team} max={3} size="sm" overlap={0.4} />

Props

PropTypeDefaultDescription
avatars{ id, name, src? }[]The people. src is an image URL (or a require() on React Native); without it the initials show.
maxnumber4Avatars shown before the +N chip.
size'sm' | 'md' | 'lg''md'Avatar diameter: 28, 36 or 44 pt.
overlapnumber0.3How much each avatar slides under the previous one, as a share of its size.
spreadGapnumber6Space between avatars once spread, in pt.
hapticsbooleantrueSelection tick as the named avatar changes.
classNamestringOuter classes (margins...).

Source

Previous: CopyButton · Next: Tooltip · All components

dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.