Skip to content

TkxAvatar

Sizes (xs → xl)
Aisha Khan
Aisha Khan
Aisha Khan
Aisha Khan
Aisha Khan
import { TkxAvatar } from 'tekivex-ui';
<TkxAvatar src="/path/to/photo.jpg" alt="Aisha Khan" />
Initials fallback (no src)

When src fails or isn’t provided, the avatar renders initials derived from alt:

<TkxAvatar alt="Aisha Khan" /> {/* renders "AK" */}
<TkxAvatar alt="Marcus Lee" /> {/* renders "ML" */}
<TkxAvatar alt="李伟" /> {/* renders "李" */}

The colour is derived from the name hash, so each user consistently gets the same background.

<TkxAvatar size="xs" {...props} /> {/* 24px */}
<TkxAvatar size="sm" {...props} /> {/* 32px */}
<TkxAvatar size="md" {...props} /> {/* 40px (default) */}
<TkxAvatar size="lg" {...props} /> {/* 56px */}
<TkxAvatar size="xl" {...props} /> {/* 80px */}

Custom size:

<TkxAvatar size={64} {...props} />
Status indicators
Aisha Khan
Marcus Lee
Priya Sharma
Dan Choi
<TkxAvatar src="..." alt="..." status="online" />
<TkxAvatar src="..." alt="..." status="busy" />
<TkxAvatar src="..." alt="..." status="away" />
<TkxAvatar src="..." alt="..." status="offline" />

Compose multiple avatars with overlap and an overflow count:

import { TkxAvatarGroup } from 'tekivex-ui';
<TkxAvatarGroup max={3}>
<TkxAvatar alt="Aisha Khan" src="..." />
<TkxAvatar alt="Marcus Lee" src="..." />
<TkxAvatar alt="Priya Sharma" src="..." />
<TkxAvatar alt="Dan Choi" src="..." />
<TkxAvatar alt="Eve Park" src="..." />
</TkxAvatarGroup>
{/* renders 3 avatars + "+2" pill */}
<TkxAvatar shape="circle" {...props} /> {/* default */}
<TkxAvatar shape="rounded" {...props} /> {/* rounded square */}
<TkxAvatar shape="square" {...props} />

TkxAvatar uses no hooks. Safe for Next.js Server Components.

  • alt is required and used both as <img alt> and as the source for the initials fallback. Never use the empty string — it makes the avatar invisible to screen readers.
  • The status dot is decorative (aria-hidden); convey status text in the surrounding context if it matters.
PropTypeRequiredDescription
srcstringImage URL.
altstringyesAccessibility text + initials source.
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | numberDefaults to md.
shape'circle' | 'rounded' | 'square'Defaults to circle.
status'online' | 'busy' | 'away' | 'offline'Status dot.
bgColorstringOverride the auto-derived initials background.

src/components/TkxAvatar.tsx