Chapter 09 Labels
Avatar group
Several people in a small space: the first few avatars overlap and a '+3' stands for the rest. The group has a name, every avatar is still named, and '+3' is read as '3 more'.
import { AvatarGroupComponent } from '@okaapi-ui/angular';A team
<ui-avatar-group label="Kitchen team" [people]="people" [max]="3" />
people = [{ name: 'Hatem Mohamed', src: '/hatem.jpg' }, { name: 'Mohamed Ibrahim' }, …];In Arabic
Translate the '+n' name with moreLabel.
<ui-avatar-group label="فريق المطبخ" [people]="people" [max]="2" [moreLabel]="more" />
more = (count: number) => `${count} آخرون`;When to use something else
| If you need | Use |
|---|---|
| One person | Avatar |
| Every name visible, such as a list of attendees | A list or Data table |
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
label | string | — | Required. Who the group is, for screen readers. |
people | AvatarPerson[] | — | Required. { name, src? } for each person, in order. |
max | number | 4 | How many avatars to show before "+n". |
size | 'sm' | 'md' | 'lg' | 'md' | Size of every avatar. |
moreLabel | (count: number) => string | (n) => `${n} more` from labels | The spoken name of "+n". Translate it. |
Keyboard and screen readers
- The group has a name, every avatar is still named, and +3 is read as 3 more.