Avatar
An image that lets users recognize a person at a glance.
An avatar represents a person with a profile image. Its fallback stands in while the image loads and when it is missing, so users can always tell who is meant.
Usage
Examples
Fallback
New employees and external contacts often have no profile image yet. Without an image, AvatarFallback takes its place right away, for example with the initials of the person, so users can still tell the people in a list apart.
Small
Table rows and activity feeds name a person beside every entry, such as the employee who booked a transfer. There, size set to "sm" lets the avatar accompany the entry without pushing the figures aside.
Default Size
Comments, approvals and assignments show the person behind a decision. Whenever no other size is set, an avatar takes the size "default", so people appear at the same scale across every product.
Large
A profile header or the detail view of an employee puts one person at the center. Here, size set to "lg" gives the avatar more presence, so users see at once whose data they are working with.
Badge
Whether a colleague is on shift or has approved a request often matters as much as who that colleague is. Through AvatarBadge the avatar carries a marker for such a status, so users take in the person and the state together.
Badge with Icon
A plain marker tells users that a status applies, but not which one. Placed inside the badge, an icon names it, so users can tell several states apart without a legend. Small avatars leave too little room for it, and the badge then shows the marker alone.
Group
Shifts, store visits and stock counts often involve several people at once. Gathered in an AvatarGroup, their avatars stay compact, so users see at a glance who shares the task.
Group Count
Some teams are larger than the room a group can offer. Closing the group, AvatarGroupCount states how many more people belong to it, so users grasp the size of the team without a face for every member.
Group Count with Icon
Not every group needs an exact number, for example where a team changes in the course of the day. With an icon in place of the number, AvatarGroupCount signals that more people belong to the group without stating how many.
API Reference
Avatar
| Prop | size |
|---|---|
| Type | "default" | "sm" | "lg" |
| Default | "default" |
| Description | Controls the dimensions of the avatar. The fallback text, the badge and the group count follow it. |
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the avatar with another component. |
AvatarImage
| Prop | src |
|---|---|
| Type | string |
| Default | – |
| Description | Sets the URL of the image. The fallback shows while the image loads and when it fails to load. |
| Prop | alt |
|---|---|
| Type | string |
| Default | – |
| Description | Describes the image for users who can't see it. |
| Prop | onLoadingStatusChange |
|---|---|
| Type | (status: "idle" | "loading" | "loaded" | "error") => void |
| Default | – |
| Description | Runs when the loading status of the image changes. |
| Prop | keepMounted |
|---|---|
| Type | boolean |
| Default | false |
| Description | Keeps the image element in the DOM and loads the image there instead of preloading it. Set it for lazy loading or for an optimized image component such as next/image. |
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the image with another component. |
AvatarFallback
| Prop | delay |
|---|---|
| Type | number |
| Default | 0 |
| Description | Sets how many milliseconds the fallback waits before it appears. An image that loads within this time replaces it before users see it. |
| Prop | render |
|---|---|
| Type | ReactElement | render function |
| Default | – |
| Description | Replaces the native element or composes the fallback with another component. |
AvatarBadge
AvatarBadge places a marker on the bottom right corner of the avatar. It renders a span and has no props of its own.
AvatarGroup
AvatarGroup stacks avatars so that they overlap. It renders a div and has no props of its own.
AvatarGroupCount
AvatarGroupCount ends a group with a count of further avatars or an icon. It renders a div and has no props of its own.