Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Avatar

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

avatar.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/avatar.json

It 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

Default

A round avatar, a rounded one and a group.

Its preview and code are at the top of the page.

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.