Overlapping avatars with one shared tooltip that hands off between faces.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/avatar-group.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/avatar-group.json
Turn on the motion
npx @prequelui/cli@latest animate avatar-groupThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import {
AvatarGroup,
AvatarGroupItem,
} from "@/components/prequelui/avatar-group";
export default function Demo() {
return (
<AvatarGroup>
<AvatarGroupItem name="Mina" />
<AvatarGroupItem name="Theo" />
<AvatarGroupItem name="Iris" />
<AvatarGroupItem name="Noé" />
</AvatarGroup>
);
}import { AvatarGroup } from "@/components/prequelui/avatar-group";
export function Variant() {
return (
<AvatarGroup tempo={1.2}>
…
</AvatarGroup>
);
}Animation
Hovering a face lifts it by thirty percent of its height while one shared tooltip glides to that face. Moving across the row hands the tooltip over instead of closing and reopening it, so the row feels like one object.
- Avatar lift: spring 300 / 17, the bounciest value in the library.
- Tooltip: spring 400 / 29 and a horizontal handoff, not a remount.
- The tooltip stays mounted while any avatar in the group is hovered.
- Overlap is 12 px; `invertOverlap` flips the stacking order.
- Reduced motion removes the lift and keeps the label change.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
AvatarGroup
| Prop | Type | Default |
|---|---|---|
| invertOverlap | boolean | false |
| tooltipSideOffset | number | 8 |
| className | string | — |
AvatarGroupItem
| Prop | Type | Default |
|---|---|---|
| name | string | — |
| src | string | — |
| children | ReactNode | initials |
| className | string | — |