Chewypixel component
Avatar Group
Overlapping avatars with a +N count once there are more than fit.
Installation
npx shadcn@latest add @chewypixel/avatar-groupUsage
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { AvatarGroup } from "@/components/ui/avatar-group";
const members = [
{ name: "Sally Howe", image: "/avatars/sally.png" },
{ name: "Hunter Murazik", image: "/avatars/hunter.png" },
{ name: "Emma Will", image: "/avatars/emma.png" },
{ name: "Angel Lang", image: "/avatars/angel.png" },
{ name: "Myah Adams", image: "/avatars/myah.png" },
];
export function Members() {
return (
<AvatarGroup max={4}>
{members.map((member) => (
<Avatar key={member.name}>
<AvatarImage src={member.image} alt={member.name} />
<AvatarFallback>{member.name[0]}</AvatarFallback>
</Avatar>
))}
</AvatarGroup>
);
}Props
maxThe most items to show, counting the +N. Leave it out to show everyone.
number
classNameClasses for the row. Each avatar is 32px with a ring in the background color; override with *: classes.
string
Released under the MIT License.
More components
- Typing IndicatorThree dots that bob in turn while someone is typing.
- Emoji PickerA searchable emoji picker with categories and a preview of the emoji you're on.
- Segmented ControlMutually exclusive options with a highlight that slides to the selected one.
- TabsUnderline tabs. The underline slides to the active tab and resizes to fit its label.
See them in a real app
These components come from Bubblegum, our messenger template built with Next.js, shadcn/ui and Motion.