Avatar

An image element with a fallback for representing the user.

Overview

The Avatar component displays user profile images with automatic fallback to initials or custom content when images fail to load, providing consistent user representation across your application.

The AvatarGroup wrapper arranges multiple avatars in an overlapping stack with optional integrated tooltips. It uses a CSS mask to cut a clean negative-space gap between adjacent avatars, so it stays bg-color independent on any surface.

Usage

import {
  Avatar,
  AvatarFallback,
  AvatarGroup,
  AvatarGroupTooltip,
  AvatarImage,
} from "@tilt-legal/cubitt-components/primitives";
<Avatar>
  <AvatarImage src={imageUrl} alt="User name" />
  <AvatarFallback>IW</AvatarFallback>
</Avatar>

Examples

Basic

Fallback

Display fallback content when the image fails to load or is not available.

With Indicator

Add indicators such as verification badges to avatars.

With Status

Display user online/offline status using the AvatarStatus component.

With Badge

Combine avatars with badges to show notification counts or other indicators.

Sizes

Avatars can be sized using Tailwind's sizing utilities.

Group

Wrap avatars in AvatarGroup to display them as an overlapping stack. Add a trailing avatar with a count fallback to indicate additional users.

Group With Tooltip

Each Avatar can include an AvatarGroupTooltip child to render content on hover.

Group Inverted Overlap

Set invertOverlap to flip stack direction so the leftmost avatar sits on top.


API Reference

Avatar

The root container for the avatar component.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
...propsReact.ComponentProps<typeof Avatar>-All other avatar root props

AvatarImage

Displays the user's profile image.

PropTypeDefaultDescription
srcstring-Image source URL
altstring-Alternative text for the image
classNamestring-Additional CSS classes
...propsReact.ComponentProps<typeof AvatarImage>-All other avatar image props

AvatarFallback

Content to display when the image fails to load or is unavailable.

PropTypeDefaultDescription
childrenReact.ReactNode-Fallback content (usually initials or icon)
classNamestring-Additional CSS classes
...propsReact.ComponentProps<typeof AvatarFallback>-All other avatar fallback props

AvatarIndicator

Container for indicators like status badges or notification counts.

PropTypeDefaultDescription
childrenReact.ReactNode-Indicator content
classNamestring-Additional CSS classes for positioning
...propsReact.HTMLAttributes<HTMLDivElement>-All other div HTML attributes

AvatarStatus

Displays a status indicator (online, offline, busy, away).

PropTypeDefaultDescription
variant"online" | "offline" | "busy" | "away""online"Status variant
classNamestring-Additional CSS classes
...propsReact.HTMLAttributes<HTMLDivElement>-All other div HTML attributes

AvatarGroup

Wraps multiple Avatar components in an overlapping stack with mask-based separation. Avatars render directly unless they include AvatarGroupTooltip, in which case the avatar container becomes the tooltip trigger.

PropTypeDefaultDescription
childrenReact.ReactElement[]-Array of Avatar components to render in the group
invertOverlapbooleanfalseInverts the overlap direction of avatars
sizestring | number43Size of each avatar in pixels
borderstring | number3Border width used to compute the mask cutout (px)
columnSizestring | number37Width of each avatar column (px) — controls overlap
align"start" | "center" | "end""end"Vertical alignment of avatars
classNamestring-Additional CSS classes to apply to the group
...propsReact.ComponentProps<"div">-All other div HTML attributes

AvatarGroupTooltip

Renders tooltip content shown on hover for a group avatar. Add it as a child of an Avatar inside AvatarGroup.

PropTypeDefaultDescription
childrenReact.ReactNode-Content to display in the tooltip
sideTooltipContentProps["side"]"top"Preferred tooltip side
sideOffsetTooltipContentProps["sideOffset"]12Distance between the avatar and tooltip
classNamestring-Additional CSS classes to apply to the tooltip
...propsReact.ComponentProps<typeof TooltipContent>-All other tooltip content props

On this page