Avatar

A component for displaying user avatars with a fallback option.

In this guide, you'll learn how to use the Avatar component.

M
Was this example helpful?

Usage#

Code
import { Avatar } from "@medusajs/ui"
Code
1<Avatar2  src="https://avatars.githubusercontent.com/u/10656202?v=4"3  fallback="M"4/>

API Reference#

This component is based on the Radix UI Avatar primitive.

PropTypeDefault
src
string
-
fallback
string
-
variant
"squared"
|"rounded"
"rounded"
size
"2xsmall"
|"xsmall"
|"small"
|"base"
|"large"
|"xlarge"
"base"
Was this helpful?

Examples#

Avatar Variants#

MM
Was this example helpful?

Avatar Sizes#

MMMMMM
Was this example helpful?

Avatar Fallback Only#

JD
Was this example helpful?

Avatar Custom Styling#

M
Was this example helpful?

Avatar Accessibility#

You can add the aria-label prop to the Avatar component for better accessibility.

M
Was this guide helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break