🚀ReacUI is currently in Beta. We're actively improving it! ❣️
Avatar
An image component for displaying user profile pictures with fallback states
JD
InitialsFallback
Installation
The Avatar component is part of the ReacUI library. Install the package to use it in your project.
Import
Import the Avatar component into your React component.
Avatar Sizes
The Avatar component comes in different sizes to fit your needs.
Avatar Variants
Customize the style of your avatars with different variants.
JD
TS
AB
CD
Avatar Fallback
Avatars can display a fallback when the image fails to load.
EF
Avatar Group
Group multiple avatars together to represent a team or collection of users.
+3
API Reference
The following props are available for the Avatar components.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
| Avatar | src | string | - | The source URL of the avatar image. |
| alt | string | '' | Alt text for the avatar image. | |
| size | string | 'md' | Size of the avatar: 'xs', 'sm', 'md', 'lg', 'xl'. | |
| variant | string | 'secondary' | Color variant: 'primary', 'secondary', 'success', 'danger', etc. | |
| initials | string | - | Initials to display when no image is available. | |
| fallback | boolean | string | false | Type of fallback to use when image fails to load. | |
| Avatar.Group | max | number | - | Maximum number of avatars to display before showing the counter. |
| Avatar.Counter | count | number | 0 | Number of additional avatars to represent in the counter. |