Skip to content

Components

Avatar

A person's image with initials as a fallback, a presence dot and overlapping groups.

Customize
Ombelle · light

Installation

Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.

pnpm dlx @ombelle-ui/cli@1.1.2 add avatar

Adds components/ui/avatar.tsx and installs react, @radix-ui/react-avatar, clsx, tailwind-merge with lifecycle scripts disabled. This is a client component.

In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.

Usage

example.tsx
import { Avatar, AvatarImage, AvatarFallback, AvatarStatus } from '@/components/ui/avatar'

export function Owner() {
  return (
    <Avatar role="img" aria-label="Ada Lovelace, online">
      <AvatarImage src="/ada.png" alt="" />
      <AvatarFallback>AL</AvatarFallback>
      <AvatarStatus />
    </Avatar>
  )
}

API and states

API
Avatar (size, variant, shape), AvatarImage, AvatarFallback (delayMs, 600 by default), AvatarStatus (status), AvatarGroup, AvatarOverflow (count, label)
Minimum states
Image, fallback after the delay, online, offline, circle and square, overflow count
Native basis
Reviewed Radix avatar primitive
Styles
Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.