Avatar group
MSOLINJE
npx shadcn add @klarhimmel/avatar-groupCopy for AIExamples
Basic
Sizes
Overflow
DetailsAbout, usage, props and more
People who share something, overlapped, with the rest collapsed into a named +N chip.
When to use
Use for
Members of a team, watchers of a booking, guests in a party.
Not for
One person. Use Avatar. A list people act on. Use a list or Table.
Pairs with
Avatar, Tooltip, Badge.
Preview
MSOLINJE
Six people on the events team.
Import
Import
- Files
- avatar-group.tsx, in components/klarhimmel/ui/. With it: avatar, theme, utils.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
people | { name: string; src?: string }[] | required | Required. Names become the accessible names and the initials. |
max | number | 4 | How many show before the "+N" chip. Default 4. |
size | Exclude<AvatarProps['size'], 'lg'> | 'sm' | Avatar size. |
aria-label | string | - | Names the group when the default (the names, then "and N more") is not what you want. |
moreLabel | (n: number) => string | (n) => `${n} more` | The chip's name: default "3 more". Pass it translated. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Not interactive: nothing to focus |
The group is named after who is in it, and the +N chip is named "N more", so the overflow is heard as well as seen.
Accessibility