Skip to main content

Avatar

Show a user’s profile image or initials in a compact, visual element.

string

An alternative text that describes the avatar for the reader to understand what it is about or identify the user the avatar belongs to.

Anchor to initials
initials
string

Initials to display in the avatar.

"small" | "small-200" | "base" | "large" | "large-200"
Default: 'base'

Size of the avatar.

string

The URL or path to the image.

Initials will be rendered as a fallback if src is not provided, fails to load or does not load quickly

Learn more about registering events.

Anchor to error
error
OnErrorEventHandler
<typeof tagName> | null
Examples
<s-avatar alt="John Doe" initials="JD" />

Preview

  • Identifying individuals or businesses
  • Representing merchants, customers, or other entities visually
  • Seeing visual indicators of people or businesses in lists, tables, or cards

  • small-200: use in tightly condensed layouts
  • small: use when the base size is too big for the layout, or when the avatar has less importance
  • base: use as the default size
  • large: use when an avatar is a focal point, such as on a single customer card
  • large-200: use when extra emphasis is required

For avatars, we recommend using a format that describes what will show in the image:

  • alt="Person's name" if avatar represents a person
  • alt="Business's name" if avatar represents a business
  • alt="" if the name appears next to the avatar as text
Was this page helpful?