Skip to main content

Avatar

The TkAvatar represents a user, labels, and display the images or a brand.

import { TkAvatar, TkAvatarGroup } from '@takeoff-ui/react'

Basic​

A simple TkAvatar displaying initials or a default icon.

View Code
<TkAvatar label="JS" />
<TkAvatar label="AD" rounded />
<TkAvatar />

Sizes​

Demonstrates various avatar sizes available via the size property.

View Code
<TkAvatar size="xlarge" rounded label="XL" />
<TkAvatar size="large" rounded label="L" />
<TkAvatar size="base" rounded label="M" />
<TkAvatar size="small" rounded label="S" />
<TkAvatar size="xsmall" rounded label="XS" />

Variants​

Showcases different variant levels (variants) of the avatar using the variant property.


View Code
<TkAvatar background="solid" variant="primary" label="PR" />
<TkAvatar background="solid" variant="light" label="LT" />
<TkAvatar background="solid" variant="success" label="SC" />
<TkAvatar background="solid" variant="info" label="IN" />
<TkAvatar background="solid" variant="warning" label="WN" />
<TkAvatar background="solid" variant="danger" label="DG" />

Avatar with Images​

Displays how to use images inside the TkAvatar component.

View Code
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="primary" rounded />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="light" rounded />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="success" rounded />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="info" rounded />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="danger" rounded />

<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="primary" />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="light" />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="success" />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="info" />
<TkAvatar image="https://via.placeholder.com/40" background="solid" variant="danger" />

Avatar with Badges​

Illustrates adding badges to avatars using the badge and badgeStatus properties.

View Code
<TkAvatar image="https://via.placeholder.com/40" background="solid" badge badgeStatus="success" rounded />
<TkAvatar image="https://via.placeholder.com/40" badge badgeStatus="warning" rounded />
<TkAvatar label="AD" badge badgeStatus="danger" rounded />

Avatar Group​

Shows how to group multiple avatars together using the TkAvatarGroup component.

View Code
<TkAvatarGroup>
<TkAvatar image="https://via.placeholder.com/40" variant="primary" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="light" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="success" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="info" background="solid" rounded label="TK" />
<TkAvatar variant="light" background="solid" rounded label="+4" />
</TkAvatarGroup>
<TkAvatarGroup compact>
<TkAvatar image="https://via.placeholder.com/40" variant="primary" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="light" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="success" background="solid" rounded />
<TkAvatar image="https://via.placeholder.com/40" variant="info" background="solid" rounded label="TK" />
<TkAvatar variant="light" background="solid" rounded label="+4" />
</TkAvatarGroup>

API​

Props​

NameTypeDefaultDescription
stringnullID of the element that labels the avatar - accessibility
"brand", "solid"'brand'Background style of the avatar
booleanfalseThe badge to be displayed in the avatar
"danger", "info", "success", "warning"'success'The status of the badge
stringnullURL of the image to be displayed in the avatar
stringnullText label to be displayed in the avatar
stringnullName associated with the avatar - accessibility
booleanfalseWhether the avatar should have rounded corners
"base", "large", "small", "xlarge", "xsmall"'base'Size of the avatar
"danger", "info", "light", "primary", "success", "warning"'primary'Appearance of the avatar