Bridge UI

Avatar

Displays a user image, initials fallback, or icon.

Introduction

Avatars represent people, accounts, or entities across your interface—in profile menus, comment threads, user lists, and team displays.

When to use: Display a user’s photo, initials, or a recognizable icon whenever identity needs to be shown at a glance.

Compared to similar components:

  • Badge — A compact label for counts, status text, or tags. Use Badge for standalone indicators like “New” or “3”; use Avatar to show who something belongs to. Compose them together when you need an identity marker with a status label nearby.
  • Unlike overlay-style badge patterns in other UI libraries, Bridge Badge does not wrap another element—it renders as its own inline label. Position a Badge next to an Avatar when indicating status (e.g. online/offline).

Use the framework selector in the site header to switch between React and Vue.

Import

import { Avatar } from "@bridge-ui/vue/Components/Avatar";
import { Avatar } from "@bridge-ui/react/Components/Avatar";

Basic usage

An Avatar can display an image (src), initials (fallback), or an icon. When no src or fallback is provided, a default user icon is shown.

Image avatars

Create image avatars by passing src and alt props. The alt text is used for accessibility when the image is displayed.

Letter avatars

Avatars with simple characters can be created by passing a string to the fallback prop. Combine with color to change the background.

Icon avatars

Icon avatars are created by passing an icon to the icon prop. The icon is shown when no image or fallback text is available.

Sizes

Change the avatar size with the size prop. Available sizes: 2xs, xs, sm, md, lg, xl, and 2xl.

Rounded

If you need square or rounded avatars, use the rounded prop. The default is full (circular).

Fallback slot

When no image is available, you can provide custom fallback content via the fallback slot instead of using the fallback prop.

Customization

Use the classes prop to style individual parts: root, fallback, and image.

Accessibility

  • Always provide meaningful alt text when displaying an image via src.
  • When the avatar is decorative and the person’s name appears in adjacent text, you may use an empty alt="" on the image.
  • Fallback initials and icons are visible content—ensure surrounding text identifies the person so screen reader users have full context.
  • For icon-only or initials avatars without adjacent labels, provide an accessible name on a wrapping element (e.g. aria-label="Jane Doe").

Anatomy

The Avatar component renders a root <div> that displays one of an image, fallback text, custom slot content, or a default icon:

<div class="avatar-root">
  <!-- one of: -->
  <img class="avatar-image" src="..." alt="Jane Doe" />
  <span class="avatar-fallback">JD</span>
  <!-- or icon -->
</div>

Badge

API

Prop Type Default Description
src string Image source URL.
alt string Alt text for the image.
fallback string Initials shown when no image is available.
icon IconSource Icon shown when no image or fallback text.
color AvatarColor "secondary" Background color for fallback/icon.
size AvatarSize "md" Avatar dimensions.
rounded AvatarRounded "full" Border radius.
classes AvatarClasses Classes for root, fallback, image.
slots AvatarSlots React slot: fallback.