Park UI

Avatar

A display component for showing user profile images, icons, or initials.

CB

Installation

Usage

Examples

Sizes

Use the size prop to change the size of the avatar.

CB
CB
CB
CB
CB
CB

Variants

Use the variant prop to change the variant of the avatar.

CB
CB
CB
CB

Shapes

Use the shape prop to change the shape of the avatar.

CB
CB
CB

Fallback

If the image fails to load, the avatar will display the user’s initial. When no name is provided, a generic icon is shown instead.

CB

Colors

Combine the colorPalette prop with some custom logic to dynamically change the color of the avatar.

SN
BL
JL

Ring

Use the outline props to add a ring around the avatar.

CB

Group

The Group component lets you display multiple avatars together. Use the stacking prop to control the order in which avatars overlap.

CS
SA
PK
+3
CS
SA
PK
+3
CS
SA
PK
+3

Badge

Show a badge on the right corner of the avatar by composing the Float and Circle components.

CB

Persona

Here's an example of how to use the Avatar component to display a user persona.

CB

Christian Busch

christian@park-ui.com

Next.js

Here's an example of how to compose the avatar with Next.js Image.

Closed Component

Here's how to setup the avatar for a closed component composition.

Props

Root

PropDefaultType
size'md'
'full' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
variant'subtle'
'solid' | 'surface' | 'subtle' | 'outline'
shape'full'
'full' | 'square' | 'rounded'
borderless
boolean
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

ids
Partial<{ root: string; image: string; fallback: string }>

The ids of the elements in the avatar. Useful for composition.

onStatusChange
(details: StatusChangeDetails) => void

Functional called when the image loading status changes.

Fallback

PropDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

Image

PropDefaultType
asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.