Avatar
<Avatar>TailwindCSS ModulesA rich user avatar component supporting images, initials, placeholders, status indicators, verification badges, and company logos.
npx coloxo add avatar --style coloxo-cssimport { Avatar } from '@coloxo/ui';Design Tokens:
1. Variant Matrix
Avatars support images (with fallback to initials), bare initials, and placeholders, with various indicators.
| Image | Initials | Placeholder | Status | Verified | Company Badge | Count | |
|---|---|---|---|---|---|---|---|
| Circle | C | ||||||
| Squircle | C |
2. Control heights (Sizes)
The Avatar component supports 6 sizes ranging from 24px (xs) to 64px (2xl). Indicators scale proportionally.
Sizes
size="xs"Dense tables, inline text
size="sm"Secondary lists, dropdowns
size="md"DEFAULTStandard forms, page headers
size="lg"Hero sections, cards
3. Interactive Props Configurator
Rounded (Circle)
Border (Padding Ring)
<Avatar src="https://i.pravatar.cc/150?u=a042581f4e29026704a" alt="Olivia Rhye"/>4. Dark theme
Avatars update their borders, backgrounds, and status rings to contrast against dark backgrounds.
5. Enterprise layout compositions
Avatars are widely used in headers, profile cards, and data tables.
Accessibility
When using the `src` prop, always provide an `alt` prop with the user's name so screen readers can identify the image.
Status indicators (online/offline) and verified badges automatically inject an aria-label into their respective DOM nodes for screen readers.
If an image fails to load, the Avatar automatically removes the alt text from the wrapper and shows the initials text cleanly to screen readers.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| size | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | md | Diameter 24–64px. |
| border | boolean | — | Outer border with padding. |
| contrastBorder | boolean | true | Inner contrast ring. |
| rounded | boolean | true | Full circle vs soft square. |
| status | "online" | "offline" | "busy" | "away" | — | Presence indicator. |
| verified | boolean | — | Verified tick (Coloxo brand). |
| badge | ReactNode | — | Company logo badge (use AvatarCompanyIcon). |
| count | number | — | Count pill. |
| initials | string | — | Fallback initials. |