Search documentation

Find a component or a docs page

Avatar

An image element with a fallback for representing the user.

Usage

Image & fallback

The fallback shows while the image loads, and stays if it fails.

Only fallback

Sizes

sm, default and lg match shadcn; xs and xl are RubyUI extras. :md still works as an alias of :default.

Sizes (only fallback)

Badge

AvatarBadge sits on the bottom-right corner, e.g. an online status.

Group

AvatarGroup overlaps the avatars; AvatarGroupCount shows how many are left.

Fallback delay

delay: (ms) waits before showing the fallback, so a fast image doesn't flash the initials first. The avatar dispatches ruby-ui--avatar:status with detail.status (loading, loaded or error) on every change. The delay needs JavaScript: without it, a delayed fallback stays hidden.

Installation

Components

ComponentBuilt usingSource
AvatarPhlex
AvatarBadgePhlex
AvatarDocsPhlex
AvatarFallbackPhlex
AvatarGroupPhlex
AvatarGroupCountPhlex
AvatarImagePhlex
AvatarControllerStimulus JS