Skip to content

Avatar

The Avatar component displays an image, icon, or text in a flexible, scalable container. It is designed to easily integrate with other components, making it ideal for profile pictures, initials, or symbolic icons.

Example

Basic Avatar

This example demonstrates the basic usage of the Avatar component, displaying a custom background color and a single initial. Although the default text color of the avatar is black, it is automatically changed to white in this case to ensure sufficient contrast against the selected background color. This guarantees that the text remains readable without requiring manual adjustment.

Avatar with Icon

This example shows the Avatar component displaying an icon. Even though the initial property is set, the icon is rendered instead because it has a higher display priority. If the image property were also provided, the image would take precedence and be displayed instead of both the icon and the initial.

Tile Shape Avatar

This example demonstrates the usage of the tile property, which allows the avatar to be displayed as a square rather than the default circular shape. The first avatar uses only the tile property, producing a fully square appearance without any corner rounding. The second avatar additionally uses the rounded property with a medium (md) value, resulting in a tile shape with rounded corners.

Props

PropertyTypeDefaultDescription
visiblebooleantrueControls whether the avatar is visible.
positionnumber[]0 0 0Sets the avatar’s position in 3D space.
sizeenum (small, medium, large)mediumSpecifies the size of the component.
opacitynumber1Specifies the opacity of the component.
colorstring (blue, #fff)#00BA92Defines the background color of the avatar.
textcolorstringblackSpecifies the color of the text displayed within the avatar. If the contrast with the background is insufficient, the text color will not be applied.
textstring""Specifies the text to be displayed inside the avatar.
iconstring""Specifies the icon to be displayed inside the avatar.
imagestring""Specifies the image to be displayed inside the avatar.
tilebooleanfalseIf true, removes the circular shape and makes the avatar square. Can be used with the rounded property for custom border radius.
roundedenum (sm, md, lg)""Applies rounded corners to the avatar. Uses predefined sizes (sm, md, lg)