Avatar
An image element representing the user. This component contains a fallback state and a group state. The fallback state can be used to display the user’s initials when an image is not available. The group state can be used to display multiple avatars in a group.
API DocumentationImport
import { Avatar } from "@aeonkit/react";Usage
With Image
Use the Avatar.Image component to display an image avatar.
<Avatar.Image size="xl" alt="Tim Cook" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"/>With Initials
Use the Avatar.Fallback component to display the user’s initials when an image is not available.
<Avatar.Fallback>BR</Avatar.Fallback>With Fallback Icon
Use the Avatar.Fallback component to display a fallback icon when an image is not available.
<Avatar.Fallback> <LuUser2 className="text-slate-500 h-full w-full" /></Avatar.Fallback>Group
You limit the number of avatars to be displayed in a group by using the maxLimit prop.
<Avatar.Group maxLimit={2}> <Avatar.Image alt="Tim Cook" src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" /> <Avatar.Image alt="Jane Doe" src="https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" /> <Avatar.Image alt="Sarah Doe" src="https://images.unsplash.com/photo-1438761681033-6461ffad8d80?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" /></Avatar.Group>Props
API Interface: AvatarProps
- size?
-
"xs""sm""md""lg""xl"The size of the fallback avatar.
Default:
md
API Interface: AvatarFallbackProps
- maxLimit?
-
numberThe maximum number of avatars to display.
API Interface: AvatarGroupProps
- size?
-
"xs""sm""md""lg""xl"The size of the image avatar.
Default:
md
API Interface: AvatarImageProps