Avatar

Avatar is a neobrutalist React component from Cruise UI. A photo from any URL, falling back to initials or an icon; circle or square, 32–80px, status dots, auto colours and groups. Install it with npx shadcn@latest add @cruiseui/avatar.

Install

Terminal

npx shadcn@latest add @cruiseui/avatar

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners

Image from any URL

IBNE

Initials, icon and a broken URL

IBACUMG

Status, sizes and square

TB, onlineKA, awayFO, busyZM, offlineDL
AOTBNEMGKA+2

When to use it

When to use

Showing a person (or a team or brand, with the square shape) next to their name, comments or a list.

When not to

Product photos (use an image in a Card).

Props

CruiseAvatar

PropTypeDefaultDescription
name?string—The person's name: the initials and the fallback's accessible name.
initials?string—Overrides the initials from `name` (max 2 characters).
icon?ReactNode—Fallback when there's no image, name or initials (default: Lucide user).
size?number | CruiseAvatarSize"md"32 / 40 / 56 / 80px, or any number of pixels.
shape?"circle" | "square""circle"Circle (default) or a square that follows var(--radius), for brands and teams.
status?CruiseAvatarStatus——
tone?CruiseAvatarTone"muted"Background behind the initials; "auto" picks one from the name.
imageComponent?ComponentType<CruiseAvatarImageProps>—Renders the image with your component, e.g. next/image (add the host to images.remotePatterns in next.config). Gets src, alt, width, height.
referrerPolicy?HTMLAttributeReferrerPolicy——
crossOrigin?"anonymous" | "use-credentials"——
className?string——
srcstring | undefined——
altstring——

CruiseAvatarGroup

PropTypeDefaultDescription
peopleCruiseAvatarPerson[]——
max?number—How many avatars to show before the "+n" counter (all by default).
size?number | CruiseAvatarSize"md"—
shape?"circle" | "square""circle"—
tone?CruiseAvatarTone"auto"—
label?string"People"Accessible name for the group, e.g. "Team".
className?string——

Using images from S3 / Cloudinary

  • Any image URL works: S3, Cloudinary, Firebase Storage, Gravatar or your own server.
  • Public URLs and signed URLs both work. For a private bucket, pass a signed URL; if it expires or returns 403, the initials show instead.
  • To use next/image, pass imageComponent={Image} and add the image host to images.remotePatterns in next.config.
  • If your site sends a Content-Security-Policy, add the image host to img-src.

Accessibility

  • The image uses its alt text; the initials or icon fallback is role="img" named after the person.
  • Next to a visible name, pass alt="" (and no name) so it isn't read twice.
  • Status is said in words too (", online"), not only by the dot's colour.
  • The fallback shows while the image loads and if it fails: never a broken-image icon.