Avatar
An avatar is used to represent a user, team or another entity.
Usage
Local Image
An avatar can display a local image.
Remote image
An avatar can fetch a remote image.
Fallback image
A fallback image can be set in case the src
fails to load.
Loading Failure
When an image fails to load, a default image will be displayed.
Double Failure
When the fallback image fails to load, a default image will be displayed.
Src and Fallback Bypass
If no fallback image is provided and the image fails to load, the initials will be displayed instead.
Anonymous
An anonymous avatar can be displayed.
Deleted
A deleted avatar can be displayed.
Sizes
An avatar can be displayed in different sizes.
Disabled
An avatar can be disabled.
Customize the image props
Using a custom hook to retry loading the image up to 5 times with a 250ms delay.
Props
The src of the image to display if the image fails to load. If set to null, the initials will be displayed instead. *
Props to add to the img element when src is provided.
Whether or not the avatar is disabled.
The name of the Avatar. This will be used for the alt text of the image or the initials if no image is provided.
The size of the avatar. *
The src of the image to display. If not provided, the initials will be displayed instead.
The CSS className for the element. A function may be provided to compute the class based on component state.
The inline style for the element. A function may be provided to compute the style based on component state.