Skip to contents

Avatar

An easily stylable avatar component.

View as Markdown
LTLT

Anatomy

Import the component and assemble its parts:

Anatomy

API reference

Root

Displays a user’s profile picture, initials, or fallback icon. Renders a <span> element.

className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Additional Types

Avatar.Root.Props

Re-Export of Root props as AvatarRootProps

Avatar.Root.State

Image

The image to be displayed in the avatar. Renders an <img> element.

onLoadingStatusChange
function
Description

Callback fired when the loading status changes.

Type
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Additional Types

Avatar.Image.Props

Re-Export of Image props as AvatarImageProps

Fallback

Rendered when the image fails to load or when no image is provided. Renders a <span> element.

delay
number
Name
Description

How long to wait before showing the fallback. Specified in milliseconds.

Type
number | undefined
className
string | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
style
React.CSSProperties | function
Name
Type
render
ReactElement | function
Name
Description

Allows you to replace the component’s HTML element with a different tag, or compose it with another component.

Accepts a ReactElement or a function that returns the element to render.

Type

Additional Types

Avatar.Fallback.Props

Re-Export of Fallback props as AvatarFallbackProps