Avatar
Avatars represent users using initials on a colored circular background. Syhrezz uses initials-only avatars — no photo uploads. Background color is deterministic based on the user's name.
Overview
Avatars display the first two letters of a user's name in uppercase, white text, on a dark-toned background. The background color is chosen deterministically from a palette of 9 colors using name.charCodeAt(0) % 9. This ensures the same user always gets the same color across all pages.
Sizes
With Status Indicator
Avatar Group
Square Variant
Used for logos and company avatars — not user avatars.
Background Color Palette
| Class | Hex Value | Index (name.charCodeAt(0) % 9) |
|---|---|---|
| .av-slate | #1E293B | 0 |
| .av-indigo | #312E81 | 1 |
| .av-green | #065F46 | 2 |
| .av-red | #7C2D12 | 3 |
| .av-blue | #1E40AF | 4 |
| .av-purple | #3B0764 | 5 |
| .av-teal | #134E4A | 6 |
| .av-amber | #78350F | 7 |
| .av-gray | #374151 | 8 |
AI Implementation Notes
<span> elements, always circular (border-radius:50%). Initials are always the first two characters of the full name, uppercase. Background color uses: const COLORS = ['#1E293B','#312E81','#065F46','#7C2D12','#1E40AF','#3B0764','#134E4A','#78350F','#374151']; bg = COLORS[name.charCodeAt(0) % 9]. In avatar groups, each avatar gets border:2px solid #fff; margin-left:-8px (first child: margin-left:0). The overflow counter ("+N") uses background:#475569.
When to Use
- Representing a user in tables, lists, comments
- Profile headers and user chips in topbar
- Avatar groups to show team members
- Representing a company or entity — use a square variant or logo
- As a standalone CTA — wrap in a button
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | required | — | User's full name. Initials are derived as first 2 characters. Background color is deterministic: COLORS[name.charCodeAt(0) % 9]. |
| size | string | optional | 'md' | 'xs'(24px) | 'sm'(32px) | 'md'(40px) | 'lg'(48px) | 'xl'(64px) | '2xl'(80px) |
| status | string | optional | undefined | Status indicator dot. 'online' | 'busy' | 'offline' |
| shape | string | optional | 'circle' | 'circle' | 'square' Square variant used for company/entity avatars. |
Design Decisions
Changelog
- 6 sizes, 9-color deterministic palette, status indicators, group stacking, square variant
States
Accessibility
| Requirement | Implementation |
|---|---|
| alt text | Add aria-label="[Name]'s avatar" on avatar element for screen readers. |
| Status dot | Announce status change with aria-live region, not just visual dot change. |
Composition
Best Practices
Related Components
Anatomy
Content Rules
Behavior
Avatars are static display elements with no interactive behavior by default. They render deterministically from the user name — same name always produces same color and initials. If used inside a clickable element (e.g. a user chip in the topbar), the interaction belongs to the parent element, not the avatar. Status dots update reactively when connection state changes — no animation, instant swap.