Avatar
Avatar, avatar group and avatar with information. Sizes, status dot or ring, initials and a placeholder fallback when the image fails.
How to use it
Run npx @blossomui/react add avatar, or copy src/components/UI/Avatar/Avatar.tsx into your React project and import it.
import { Avatar, AvatarGroup, AvatarInfo } from './components/ui/Avatar'
Props
AvatarProps
| Prop | Type | Description |
|---|
| src | string | Image url. When it is missing or fails to load the initials (or a placeholder) are shown. |
| alt | string | |
| name | string | Name of the person. It is the accessible name of the avatar and the source of the initials when none are given. |
| initials | string | Shown when there is no image, e.g. "KH". Taken from `name` when it is missing. |
| size | AvatarSize | |
| square | boolean | Rounded corners instead of a circle. |
| status | AvatarStatus | |
| statusStyle | 'dot' | 'ring' | `dot` is a small circle in a corner, `ring` outlines the avatar. |
| statusPosition | 'top' | 'bottom' | |
AvatarGroupProps
| Prop | Type | Description |
|---|
| avatars (required) | Pick<AvatarProps, 'src' | 'alt' | 'name' | 'initials'>[] | Give each person a `name` to show it in a tooltip when the avatar is hovered or focused. |
| max | number | Maximum number of avatars before collapsing the rest into a +N counter. |
| size | AvatarSize | |
| onMoreClick | () => void | |
AvatarInfoProps
| Prop | Type | Description |
|---|
| name (required) | string | |
| description | ReactNode | |