Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Avatar Group
Overlapping stack of avatars with a cut-out ring around each face and a +N count for the rest. When someone joins, the others slide over to make room and the count updates in place.
Preview
import * as React from "react";
import { forwardRef } from "react";
import { View, type ViewProps, type ImageSourcePropType } from "react-native";
import Animated, {
Easing,
FadeOut,
LinearTransition,
useSharedValue,
useAnimatedStyle,
withDelay,
withSpring,
withTiming,
} from "react-native-reanimated";
import {
cn,
ease,
rowDelay,
spring,
timing,
useHaptic,
usePressAnimation,
useReducedMotion,
AnimatedPressable,
Sheen,
} from "@lumioui/core";
import { Avatar } from "../avatar";
export interface AvatarGroupItem {
/** Stable identity for the item — used as the React key when provided.
* Items with an id that arrive after mount play the join moment. */
id?: string | number;
/** Image source — falls back to initials. */
source?: ImageSourcePropType;
/** Fallback initials when no image. */
fallback?: string;
/** Accessibility label — defaults to the fallback text. */
alt?: string;
}
export interface AvatarGroupProps extends Omit<ViewProps, "className"> {
items: AvatarGroupItem[];
/** Max avatars rendered before the "+N" overflow bubble. Default 4. */
max?: number;
/** Avatar size. Default "md". */
size?: "sm" | "md" | "lg";
/** Fired when an avatar is tapped — makes avatars pressable. */
onItemPress?: (item: AvatarGroupItem, index: number) => void;
/** Makes the "+N" bubble tappable (open the full roster). */
onOverflowPress?: (items: AvatarGroupItem[]) => void;
/** Switch-on entrance on mount (dim → on, 40ms apart). Default true. */
animate?: boolean;
/** Haptic on taps. Default "light". */
haptic?: "light" | "selection" | false;
/**
* Classes for the cut-out ring around each avatar. Match it to the
* surface the stack sits on. Default `border-card` (rows, cards).
*/
ringClassName?: string;
className?: string;
}
/** Overlap per size (px) — negative margin on each item after the first. */
const OVERLAP = { sm: 10, md: 12, lg: 16 } as const;
const OVERFLOW_TEXT = { sm: "text-xs", md: "text-sm", lg: "text-base" } as const;
/** Avatar diameter per size — the +N bubble adds the 2px ring on each side
* so it lines up with the ringed avatars beside it. */
const DIAMETER = { sm: 32, md: 40, lg: 56 } as const;
/** Faces wait at half brightness before they switch on — readable, not lit. */
const MOUNT_DIM = 0.5;
/** A joining face ignites from this scale (swap grammar, no spark). */
const JOIN_FROM = 0.96;
/** The +N count travels this far as it swaps — up when it grows, down when it shrinks. */
const COUNT_TRAVEL = 4;
const igniteTiming = { ...timing.fast, easing: Easing.bezier(...ease.out) };
const dimTiming = { ...timing.recede, easing: Easing.bezier(...ease.in) };
/**
* AvatarGroup — overlapping avatar stack with a cut-out ring per avatar and
* a "+N" overflow bubble. Faces switch on in order on mount. When someone
* joins, their face ignites in its slot while the others slide over, the
* count swaps in place and one light pass crosses the stack.
* <AvatarGroup items={team} max={4} onOverflowPress={showRoster} />
* Expo Go compatible.
*/
export const AvatarGroup = forwardRef<React.ElementRef<typeof View>, AvatarGroupProps>(
function AvatarGroup(
{
items,
max = 4,
size = "md",
onItemPress,
onOverflowPress,
animate = true,
haptic = "light",
ringClassName,
className,
...props
},
ref,
) {
const haptics = useHaptic();
const reduce = useReducedMotion();
const visible = items.slice(0, Math.max(0, max));
const overflow = items.slice(Math.max(0, max));
const overlap = OVERLAP[size];
// Who was here before — anyone new with an id is a join.
const seen = React.useRef<Set<string | number> | null>(null);
if (seen.current === null) {
seen.current = new Set(items.flatMap((it) => (it.id != null ? [it.id] : [])));
}
const joinedIds = items.filter((it) => it.id != null && !seen.current!.has(it.id)).map((it) => it.id!);
const joinKey = joinedIds.join("|");
const [sheen, setSheen] = React.useState(0);
const idKey = items.map((it) => it.id ?? "").join("|");
React.useEffect(() => {
// Track the current roster, so someone who leaves and comes back joins again.
seen.current = new Set(items.flatMap((it) => (it.id != null ? [it.id] : [])));
if (joinKey) setSheen((n) => n + 1);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [idKey]);
const layout = reduce ? undefined : LinearTransition.springify().damping(spring.layout.damping).stiffness(spring.layout.stiffness);
return (
<View
ref={ref}
className={cn("flex-row items-center", className)}
accessibilityLabel={`${items.length} people`}
{...props}
>
{visible.map((item, i) => (
<GroupAvatar
// alt/fallback labels collide easily (two "JD"s, two users with
// no label) — prefer a caller-supplied id, else the position.
key={item.id ?? `avatar-${i}`}
item={item}
index={i}
size={size}
overlap={i === 0 ? 0 : overlap}
zIndex={items.length - i}
animate={animate}
joined={item.id != null && joinedIds.includes(item.id)}
layout={layout}
ring={ringClassName}
onPress={
onItemPress
? () => {
if (haptic) haptics[haptic]();
onItemPress(item, i);
}
: undefined
}
/>
))}
{overflow.length > 0 ? (
<OverflowBubble
count={overflow.length}
size={size}
overlap={visible.length > 0 ? overlap : 0}
animate={animate}
layout={layout}
ring={ringClassName}
delayIndex={visible.length}
onPress={
onOverflowPress
? () => {
if (haptic) haptics[haptic]();
onOverflowPress(overflow);
}
: undefined
}
/>
) : null}
{/* One light pass across the ring row when someone joins. */}
<View pointerEvents="none" className="absolute inset-0 overflow-hidden rounded-full">
<Sheen run={sheen} />
</View>
</View>
);
},
);
/** Arrival — on mount a face waits dim and switches on in row order; a face
* that joins later ignites in its slot (opacity + a 0.96 → 1 swap). */
function useArrive(index: number, animate: boolean, joined: boolean) {
const reduce = useReducedMotion();
const still = !animate;
const lit = useSharedValue(joined ? 0 : still ? 1 : MOUNT_DIM);
const grow = useSharedValue(joined && !reduce ? JOIN_FROM : 1);
React.useEffect(() => {
if (joined) {
lit.value = withTiming(1, igniteTiming);
if (!reduce) grow.value = withSpring(1, spring.swap);
return;
}
if (still) return;
lit.value = withDelay(rowDelay(index), withTiming(1, igniteTiming));
// Arrival runs once; later index changes are layout moves, not arrivals.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return useAnimatedStyle(() => ({
opacity: lit.value,
transform: [{ scale: grow.value }],
}));
}
/** Cut-out ring — card-coloured by default because stacks live on rows and
* cards; a canvas-coloured ring read as a grey halo on white surfaces. */
const ringBase = "overflow-hidden rounded-full border-2 border-card";
type Layout = React.ComponentProps<typeof Animated.View>["layout"];
const GroupAvatar = React.memo(function GroupAvatar({
item,
index,
size,
overlap,
zIndex,
animate,
joined,
layout,
ring,
onPress,
}: {
item: AvatarGroupItem;
index: number;
size: "sm" | "md" | "lg";
overlap: number;
zIndex: number;
animate: boolean;
joined: boolean;
layout: Layout;
ring?: string;
onPress?: () => void;
}) {
const ringClass = cn(ringBase, ring);
const press = usePressAnimation({ pressedScale: 0.9 });
const arriveStyle = useArrive(index, animate, joined);
const style = [{ marginLeft: -overlap, zIndex }, arriveStyle];
const exiting = FadeOut.duration(timing.recede.duration);
const avatar = (
<Avatar
size={size}
source={item.source}
fallback={item.fallback}
alt={item.alt ?? item.fallback ?? "Avatar"}
// The ring wrapper owns a11y — the inner avatar is presentational.
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
/>
);
if (!onPress) {
return (
<Animated.View style={style} layout={layout} exiting={exiting} className={ringClass}>
{avatar}
</Animated.View>
);
}
// The slot carries arrival + layout moves; the pressable inside carries the press dip.
return (
<Animated.View style={style} layout={layout} exiting={exiting}>
<AnimatedPressable
onPress={onPress}
onPressIn={press.onPressIn}
onPressOut={press.onPressOut}
style={press.animatedStyle}
hitSlop={4}
className={ringClass}
accessibilityRole="button"
accessibilityLabel={item.alt ?? item.fallback ?? "Avatar"}
>
{avatar}
</AnimatedPressable>
</Animated.View>
);
});
/** "+N" that swaps in place: the old count dims and drifts, the new one
* ignites from 4px on the side the count moved. */
function SwapCount({ count, className }: { count: number; className: string }) {
const reduce = useReducedMotion();
const [shown, setShown] = React.useState(count);
const [out, setOut] = React.useState<number | null>(null);
if (count !== shown) {
setOut(shown);
setShown(count);
}
const dir = out == null ? 0 : shown > out ? 1 : -1;
const lit = useSharedValue(1);
const leave = useSharedValue(0);
const mounted = React.useRef(false);
React.useEffect(() => {
if (!mounted.current) {
mounted.current = true;
return;
}
lit.value = 0;
lit.value = withTiming(1, igniteTiming);
leave.value = 1;
leave.value = withTiming(0, dimTiming);
}, [shown, lit, leave]);
const travel = reduce ? 0 : COUNT_TRAVEL * dir;
const inStyle = useAnimatedStyle(() => ({
opacity: lit.value,
transform: [{ translateY: (1 - lit.value) * travel }],
}));
const outStyle = useAnimatedStyle(() => ({
opacity: leave.value,
transform: [{ translateY: -(1 - leave.value) * travel * 0.5 }],
}));
return (
<View className="items-center justify-center">
<Animated.Text className={className} style={inStyle} allowFontScaling={false}>
{`+${shown}`}
</Animated.Text>
{out != null ? (
<Animated.Text
className={cn("absolute", className)}
style={outStyle}
allowFontScaling={false}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
{`+${out}`}
</Animated.Text>
) : null}
</View>
);
}
const OverflowBubble = React.memo(function OverflowBubble({
count,
size,
overlap,
animate,
layout,
ring,
delayIndex,
onPress,
}: {
count: number;
size: "sm" | "md" | "lg";
overlap: number;
animate: boolean;
layout: Layout;
ring?: string;
delayIndex: number;
onPress?: () => void;
}) {
const ringClass = cn(ringBase, ring);
const press = usePressAnimation({ pressedScale: 0.9 });
const arriveStyle = useArrive(delayIndex, animate, false);
const edge = DIAMETER[size] + 4;
const style = [{ marginLeft: -overlap, zIndex: 0, width: edge, height: edge }, arriveStyle];
const content = (
<SwapCount count={count} className={cn("font-semibold leading-none text-muted-foreground", OVERFLOW_TEXT[size])} />
);
if (!onPress) {
return (
<Animated.View
style={style}
layout={layout}
className={cn(ringClass, "items-center justify-center bg-muted")}
accessibilityRole="text"
accessibilityLabel={`${count} more`}
>
{content}
</Animated.View>
);
}
return (
<Animated.View style={[{ marginLeft: -overlap, zIndex: 0 }, arriveStyle]} layout={layout}>
<AnimatedPressable
onPress={onPress}
onPressIn={press.onPressIn}
onPressOut={press.onPressOut}
style={[{ width: edge, height: edge }, press.animatedStyle]}
hitSlop={6}
className={cn(ringClass, "items-center justify-center bg-muted")}
accessibilityRole="button"
accessibilityLabel={`${count} more — show everyone`}
>
{content}
</AnimatedPressable>
</Animated.View>
);
});
AvatarGroup.displayName = "AvatarGroup"; import { AvatarGroup } from "@/components/ui/avatar-group/avatar-group";
export function Example() {
return (
<AvatarGroup />
);
} Installation
Install the dependencies
npx expo install react-native-reanimatedAdd the components it builds on
Copy the source from the Code tab into your project
components/ui/avatar-group/avatar-group.tsxcomponents/ui/avatar-group/index.tsUpdate the import paths to match your project setup.
Usage
import { AvatarGroup } from "@/components/ui/avatar-group/avatar-group"; <AvatarGroup /> Examples
Who's going on an event invite.
import * as React from "react";
import { View } from "react-native";
import { Accent, tempo } from "@lumioui/core";
import { AvatarGroup, type AvatarGroupItem } from "../avatar-group";
import { Button } from "../../button/button";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
const GUESTS: AvatarGroupItem[] = [
{ id: "ines", source: { uri: "https://i.pravatar.cc/150?img=47" }, fallback: "IL", alt: "Ines Laurent" },
{ id: "theo", source: { uri: "https://i.pravatar.cc/150?img=15" }, fallback: "TM", alt: "Theo Marchetti" },
{ id: "noor", source: { uri: "https://i.pravatar.cc/150?img=29" }, fallback: "NH", alt: "Noor Haddad" },
{ id: "kai", fallback: "KO", alt: "Kai Oduya" },
{ id: "ruth", source: { uri: "https://i.pravatar.cc/150?img=44" }, fallback: "RV", alt: "Ruth Vega" },
{ id: "bao", source: { uri: "https://i.pravatar.cc/150?img=8" }, fallback: "BT", alt: "Bao Tran" },
{ id: "lena", source: { uri: "https://i.pravatar.cc/150?img=33" }, fallback: "LB", alt: "Lena Beck" },
{ id: "omar", fallback: "OS", alt: "Omar Saleh" },
{ id: "yuki", source: { uri: "https://i.pravatar.cc/150?img=20" }, fallback: "YM", alt: "Yuki Mori" },
];
const ME: AvatarGroupItem = {
id: "me",
source: { uri: "https://i.pravatar.cc/150?img=68" },
fallback: "SV",
alt: "You",
};
/** Act, hold, resolve — the stack performs the join, and the button only
* confirms after two settle beats (~630ms) so the eye catches your face landing. */
const JOIN_HOLD = tempo.settle * 2;
/** AvatarGroupOverflow — who's going on an event invite. Tap "I'm going"
* and your face ignites at the front of the stack while the others slide
* over, the +N count ticks up in place and a light pass crosses the faces;
* the button confirms after the hold. The +N bubble opens the list. */
export function AvatarGroupOverflow() {
const [going, setGoing] = React.useState(false);
const [confirmed, setConfirmed] = React.useState(false);
const [note, setNote] = React.useState<string | null>(null);
const hold = React.useRef<ReturnType<typeof setTimeout> | null>(null);
React.useEffect(
() => () => {
if (hold.current) clearTimeout(hold.current);
},
[]
);
const guests = going ? [ME, ...GUESTS] : GUESTS;
const lead = going ? "You, Ines" : "Ines, Theo";
return (
<Accent color="amber" className="w-full">
<View className="w-full gap-5 rounded-3xl bg-card p-5">
<View className="gap-1">
<Text className="text-2xl font-bold tracking-tight">Rooftop film night</Text>
<Text variant="muted">Fri, Oct 17 · 8:00 PM · Hosted by Noor</Text>
</View>
<View className="flex-row items-center gap-2">
<Icon name="map-pin" size="sm" color="mutedForeground" />
<Text className="flex-1 text-[15px]" numberOfLines={1}>Pier 9 Rooftop, Harbourside</Text>
</View>
<View className="flex-row items-center gap-3 border-t border-border pt-4">
<AvatarGroup
items={guests}
// Three faces + the count bubble leaves the caption room to read in full.
max={3}
onItemPress={(item) => setNote(item.id === "me" ? "That's you" : `${item.alt} is going`)}
onOverflowPress={(rest) => setNote(rest.map((r) => r.alt).join(", "))}
/>
<View className="flex-1">
<Text className="text-[15px] font-medium" numberOfLines={1}>{guests.length} going</Text>
<Text variant="muted" numberOfLines={1}>{note ?? `${lead} and ${guests.length - 2} more`}</Text>
</View>
</View>
<Button
size="lg"
variant={confirmed ? "secondary" : "default"}
onPress={() => {
if (going && !confirmed) return;
setNote(null);
if (going) {
setGoing(false);
setConfirmed(false);
return;
}
setGoing(true);
hold.current = setTimeout(() => {
hold.current = null;
setConfirmed(true);
}, JOIN_HOLD);
}}
icon={confirmed ? <Icon name="check" size="sm" color="foreground" /> : undefined}
>
{confirmed ? "You're going" : "I'm going"}
</Button>
</View>
</Accent>
);
} The stack at sm, md and lg in the rows that use them: a shared doc, a team, a meeting about to start.
import * as React from "react";
import { View } from "react-native";
import { AvatarGroup, type AvatarGroupItem } from "../avatar-group";
import { Icon, type IconName } from "../../icon/icon";
import { Text } from "../../text/text";
const p = (img: number, fallback: string, alt: string): AvatarGroupItem => ({
id: alt,
source: { uri: `https://i.pravatar.cc/150?img=${img}` },
fallback,
alt,
});
const ROWS: {
size: "sm" | "md" | "lg";
icon: IconName;
tile: string;
title: string;
meta: string;
people: AvatarGroupItem[];
}[] = [
{
size: "sm",
icon: "file-text",
tile: "bg-tint-teal",
title: "Q4 pricing proposal",
meta: "Edited 12 min ago",
people: [p(12, "AD", "Aiden Doyle"), p(45, "SC", "Sofia Castro"), { id: "Wen Li", fallback: "WL", alt: "Wen Li" }],
},
{
size: "md",
icon: "users",
tile: "bg-tint-pink",
title: "Growth squad",
meta: "2 of 6 online",
people: [p(36, "MB", "Marta Bianchi"), p(60, "JN", "Jomo Ndungu"), p(24, "EK", "Elif Kaya"), p(57, "RG", "Rafael Gomes"), p(49, "HS", "Hana Sato"), p(3, "LD", "Luc Dubois")],
},
{
size: "lg",
icon: "calendar",
tile: "bg-tint-orange",
title: "Design crit",
meta: "Today · 2:00 PM",
people: [p(16, "PA", "Pablo Arce"), p(38, "GM", "Grace Mensah")],
},
];
/** AvatarGroupSizes — the stack at sm, md and lg in the rows that use
* them: a shared doc, a team, a meeting about to start. */
export function AvatarGroupSizes() {
return (
<View className="w-full overflow-hidden rounded-2xl bg-card">
{ROWS.map((r, i) => (
<View key={r.size} className="flex-row items-center gap-3 pl-4">
<View className={`h-10 w-10 items-center justify-center rounded-xl ${r.tile}`}>
<Icon name={r.icon} size="sm" color="#FFFFFF" />
</View>
<View
className={`min-h-[76px] flex-1 flex-row items-center gap-3 py-3 pr-4 ${i > 0 ? "border-t border-border" : ""}`}
>
<View className="flex-1">
<Text className="text-base font-medium" numberOfLines={1}>{r.title}</Text>
<Text variant="muted" numberOfLines={1}>{r.meta}</Text>
</View>
<AvatarGroup items={r.people} size={r.size} max={3} />
</View>
</View>
))}
</View>
);
} API reference
items* AvatarGroupItem[] — max number Max avatars rendered before the "+N" overflow bubble. Default 4.
4 size "sm" | "md" | "lg" Avatar size. Default "md".
"md" onItemPress (item: AvatarGroupItem …
(item: AvatarGroupItem, index: number) => void Fired when an avatar is tapped — makes avatars pressable.
—onOverflowPress (items: AvatarGroupItem[]) => void Makes the "+N" bubble tappable (open the full roster).
—animate boolean Switch-on entrance on mount (dim → on, 40ms apart). Default true.
true haptic "light" | "selection" | false Haptic on taps. Default "light".
"light" ringClassName string Classes for the cut-out ring around each avatar. Match it to the surface the stack sits on. Default border-card (rows, cards).
className string —