UIComponentsReact
A person's picture, with initials while it loads or when it fails.
Built on the headless Avatar.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/avatar.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
Avatar holds AvatarImage and AvatarFallback; the fallback shows until the image has loaded and stays if it fails. size is sm, default or lg. AvatarBadge adds a dot at the corner, and AvatarGroup overlaps several avatars, with AvatarGroupCount for the rest. The loading status comes from the headless Avatar.
import {
Avatar,
AvatarBadge,
AvatarFallback,
AvatarGroup,
AvatarGroupCount,
AvatarImage,
} from '@/components/ui/avatar'Examples
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Avatar's API reference.