With Initials
No src, so the name collapses to initials.
import { Avatar } from '@usefragments/ui';
<Avatar name="John Smith" />Shows who someone is — their photo, or their initials when there is none.
import { Avatar } from '@usefragments/ui';
<Avatar
src="https://i.pravatar.cc/150?u=jane"
alt="Jane Doe"
name="Jane Doe"pnpm add @usefragments/uiImport styles once from @usefragments/ui/styles. See the installation guide for framework and theme setup.
Import Avatar once, then compose its parts with dot notation.
Avatar.GroupNo src, so the name collapses to initials.
import { Avatar } from '@usefragments/ui';
<Avatar name="John Smith" />The control tracks: 24, 28, 32 and 40.
import { Stack } from '@usefragments/ui';
<Stack direction="row" gap="sm" align="center">
<Avatar name="Jane Doe" size="xs" />
<Avatar name="Jane Doe" size="sm" />
<Avatar name="Jane Doe" size="md" />Overlapping stack with a count for whoever did not fit.
import { Avatar } from '@usefragments/ui';
<Avatar.Group max={3}>
<Avatar name="Alice Johnson" />
<Avatar name="Bob Smith" />
<Avatar name="Carol Williams" />Prop | Type | Default | Description |
|---|---|---|---|
alt | string | undefined | | Alt text for the image |
fallback | React.ReactNode | Not set | Visual fallback rendered after initials and before the generic glyph |
Group.childrenRequired | React.ReactNode | Not set | Children (Avatar components) |
Group.max | number | undefined | Not set | Maximum number of avatars to display; the rest collapse into a +N tile |
Group.size | AvatarSize | undefinedxssmmdlg | Not set | Size for all avatars in the group |
imageProps | Omit<React.ImgHTMLAttributes<HTMLImageElement>, "className" | "style" | "src" | "alt"> | undefined | Not set | Additional props for the underlying img element (except src/alt/className/style) |
initials | string | undefined | Not set | Fallback initials (1-2 characters) |
name | string | undefined | Not set | Full name - used to generate initials |
size | AvatarSize | undefinedxssmmdlg | xs | The control track: xs 24, sm 28, md 32, lg 40 |
src | string | undefined | Not set | Image source URL |