๐ŸงจPre-releaseYou shouldn't use this library-1 min read

AvatarProps API Reference

Prop reference

TitleTypeDefaultDescription
alt*string
โ€“

The alt text for the image. Usually "x's avatar", for e.g.

srcstring
โ€“

The URL of the image to display.

colorColorPalette
| string
โ€“
experimental

The background color of the avatar. Can be a color from the palette or a custom color.

sizeSize
medium

The size of the avatar.

isSelectedboolean
โ€“

Whether the avatar is "selected" or not.

classNamestring
โ€“

Additional classNames for the root element.

rootClassNamestring
โ€“
deprecated

Additional classNames for the root element.

componentClassNamestring
โ€“

Additional classNames for the component in the image slot.

isPingingboolean
โ€“
experimental

Whether the avatar is "pinging" or not. This will add a ping animation to the avatar.

gemsArray<AvatarGem>
โ€“

Gems to display on the avatar. See related AvatarGem for type.

slotsAvatarSlots
โ€“

Slots to use for the avatar. See related AvatarSlots for type.

onClickOnClickFunction<HTMLDivElement>
โ€“

Function to call when the avatar is clicked.

* Props marked with an asterisk are required.

CSS target reference

ExportCSS Class TargetDescription
AvatarTargetClassRoot.NPUI-Avatar-root

Root of the Avatar

AvatarTargetClassImage.NPUI-Avatar-image

The Image element

AvatarTargetClassPing.NPUI-Avatar-ping

The Pinging element used for isPinging

AvatarTargetClassGem.NPUI-Avatar-gem

A Gem element on the Avatar

Exports are available from /src/components/avatar/avatar.tsx or from
Made by .