Avatar
A small picture that stands for a person or a team. Without a picture it shows their initials.
import { Avatar, AvatarSkeleton } from '@sypnia/ui/react'
Sizes
Small in dense lists, extra large on a profile.
LMLMLMLM
Code
import { Avatar } from '@sypnia/ui/react';
// Without a picture it shows up to two initials.
export default function Sizes() {
return (
<div className="sy-row">
<Avatar size="sm" name="Laura Méndez" />
<Avatar name="Laura Méndez" />
<Avatar size="lg" name="Laura Méndez" />
<Avatar size="xl" name="Laura Méndez" />
</div>
);
} People, teams, you, and a picture
Round, square, lit, and with an image.
DRNTLM
Code
import { Avatar } from '@sypnia/ui/react';
// Round for people, square for teams and projects, lit for the person who is signed in.
export default function Kinds() {
return (
<div className="sy-row">
<Avatar size="lg" name="Diego Ruiz" />
<Avatar size="lg" name="Northwind Traders" square />
<Avatar size="lg" name="Laura Méndez" lit />
<Avatar size="lg" name="Ana Castaño" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Crect width='44' height='44' fill='%236b8f84'/%3E%3Ccircle cx='22' cy='17' r='8' fill='%23e9f1ee'/%3E%3Cpath d='M6 44c2-11 9-15 16-15s14 4 16 15z' fill='%23e9f1ee'/%3E%3C/svg%3E" />
</div>
);
} Several together
Overlapping, with the count in words beside them.
LMDRACMS4 people can edit this table
Code
import { Avatar } from '@sypnia/ui/react';
const team = ['Laura Méndez', 'Diego Ruiz', 'Ana Castaño', 'Marco Silva'];
export default function Group() {
return (
<div className="sy-row">
<span className="sy-avatar-group">{team.map((name) => <Avatar key={name} name={name} />)}</span>
<span className="sy-text--sm sy-text--soft">4 people can edit this table</span>
</div>
);
} Skeleton
The real piece and its skeleton: the same box, so nothing moves when the data arrives.
LMLMLMN
Code
import { Avatar, AvatarSkeleton } from '@sypnia/ui/react';
// Every size, loaded and loading. The skeleton has the same box as the real one, so nothing moves when the data arrives.
export default function Skeleton() {
return (
<div className="sy-row">
<Avatar name="Laura Méndez" size="sm" /><AvatarSkeleton size="sm" />
<Avatar name="Laura Méndez" /><AvatarSkeleton />
<Avatar name="Laura Méndez" size="lg" /><AvatarSkeleton size="lg" />
<Avatar name="Northwind" size="xl" square /><AvatarSkeleton size="xl" square />
</div>
);
} When to use it
Use it when
- Next to a name, to find people faster in lists, comments and menus.
- Round for people,
squarefor teams, organizations and projects. litmarks the person who is signed in.
Do not use it when
- It would stand alone where the name matters: use Identity, which shows the name too.
- It is a picture of something else (a product, a file): that is an image.
- It is used as a button without a label. Wrap it in a button that says what it opens.
For everyone
- It is an image named after the person (
name), so screen readers say who it is. - Next to the same name in text (as in Identity) the name is said twice: that is acceptable, and keeps the avatar meaningful when it is alone.
- Initials keep AA contrast on night and paper.
Props
| Avatar | Type | Default |
|---|---|---|
namerequired | string | |
decorative | boolean | |
lit | boolean | |
size | "sm" | "md" | "lg" | "xl" | md |
square | boolean | |
src | string |
| AvatarSkeleton | Type | Default |
|---|---|---|
size | "sm" | "md" | "lg" | "xl" | md |
square | boolean |