Component size, gzipped: 14kb

Avatar

API

The Avatar component adds additional visual information about a user.

When to use

  • When you want to show a user's image along contextual information.
  • When you want to attribute an action to a user.

Accessibility

  • Top level name prop will be set on the <img> element as its alt attribute.
  • If src fails to load, applies aria-label with provided name and role with 'img' to root div element.

Examples

Avatar with available sizes

user
user
user
user
user

Avatar with error fallback

user
user
user
user
user

Avatar with initials

Avatar with example overrides

user name #1
beyonce knowles
user name #3
beyonce knowles

API

Avatar props

NameTypeDescription
name
Alternative text description of the image.
overrides
Lets you customize all aspects of the component.
size
Defines the width/height of the image. Accepts labels from theme.sizing, or passes value to height/width.
src
Image to display.

Avatar exports

You can import this module like so:

import {Avatar} from 'baseui/avatar'

It exports the following components or utility functions: