For AI agents: the complete documentation index is at llms.txt. Markdown versions are available by appending .md or sending Accept: text/markdown.
Reflex Logo
Docs Logo
Library

/

Data Display

/

Avatar

Avatar

The Avatar component is used to represent a user, and display their profile pictures or fallback texts such as initials.

Basic Example

To create an avatar component with an image, pass the image URL as the src prop.

Start Building Now!

To display a text such as initials, set the fallback prop without passing the src prop.

Start Building Now!

Styling

Size

The size prop controls the size and spacing of the avatar. The acceptable size is from "1" to "9", with "3" being the default.

Start Building Now!

Variant

The variant prop controls the visual style of the avatar fallback text. The variant can be "solid" or "soft". The default is "soft".

Start Building Now!

Color Scheme

The color_scheme prop sets a specific color to the fallback text, ignoring the global theme.

Start Building Now!

High Contrast

The high_contrast prop increases color contrast of the fallback text with the background.

Start Building Now!

Radius

The radius prop sets specific radius value, ignoring the global theme. It can take values "none" | "small" | "medium" | "large" | "full".

Start Building Now!

Fallback

The fallback prop indicates the rendered text when the src cannot be loaded.

Start Building Now!

Final Example

As part of a user profile page, the Avatar component is used to display the user's profile picture, with the fallback text showing the user's initials. Text components displays the user's full name and username handle and a Button component shows the edit profile button.

Start Building Now!

Reflex User

@reflexuser

API Reference

rx.avatar

An image element with a fallback for representing the user.

rx.hstack(rx.avatar(src="https://web.reflex-assets.dev/other/logo.jpg",
variant="solid",
size="1",
color_scheme="tomato",
high_contrast=False,
radius="none",
), rx.avatar(fallback="RX", **props), spacing="3")
variant
size
color_scheme
high_contrast
radius

Props

PropTypeDescription
variant
"solid""soft"

The variant of the avatar.

size
"1""2""3""4""5""6""7""8""9"

The size of the avatar: "1" - "9".

color_scheme
"tomato""red""ruby""crimson""pink""plum""purple""violet""iris""indigo""blue""cyan""teal""jade""green""grass""brown""orange""sky""mint""lime""yellow""amber""gold""bronze""gray"

Color theme of the avatar.

high_contrast
bool

Whether to render the avatar with higher contrast color against background.

radius
"none""small""medium""large""full"

Override theme radius for avatar: "none" | "small" | "medium" | "large" | "full".

src
str

The src of the avatar image.

fallback
str

The rendered fallback text.

Built with Reflex