Examples
AvatarGroup
A row of overlapping avatars, each ringed in the background color, with a "+N" for the rest: who's in a project, a chat or a meeting.
import { AvatarGroup } from 'patine-ui';
Loading…
<Card style={{ padding: 16, maxWidth: 380 }}> <VStack gap="md"> <VStack gap="xs"> <Text weight="semibold">Spring launch</Text> <Text size="sm" color="textSecondary">7 members · updated 2h ago</Text> </VStack> <HStack justify="space-between"> <AvatarGroup avatars={TEAM} max={4} size="sm" /> <Button size="sm" variant="outline">Invite</Button> </HStack> </VStack> </Card>
Try the props
maxsizeshape<AvatarGroup avatars={members} max={4} />
Example: today's meetings
A calendar's agenda: each meeting shows who's invited, up to three faces and a count for the rest, and the group's label reads every name to a screen reader.
Loading…
<ListItem key={meeting.title} title={meeting.title} description={meeting.time} trailing={ <HStack gap="sm" align="center"> <AvatarGroup avatars={people} max={3} size="sm" accessibilityLabel={people.map((p) => p.name).join(', ')} /> {'live' in meeting ? <Button size="sm">Join</Button> : null} </HStack> } /> ); })} </List>
Accessibility
The group is one image named by the people in it: "Maya Cohen, Daniel Okafor, Ana Lucía Pérez and 4 others". Set accessibilityLabel to say something else, such as "7 members".
Props
Also takes View props.
| Prop | Type | Default | Description |
|---|---|---|---|
avatars | { name?, src? }[] | — | The people, in order. |
max | number | all | Show this many, the last as "+N". |
size | 'sm' | 'md' | 'lg' | number | 'md' | Each avatar's size. |
shape | 'circle' | 'square' | 'circle' | As Avatar. |
overlap | number | 0.25 | How much each tucks under the one before, as a share of its size. |
accessibilityLabel | string | the names | Names the group. |
theme, design | As every component. |