Avatars
Show who: a person, a client or a shop, by photo or initials.
Quick usage
Import the shared component; never copy its markup into a feature. The Web TSX tab beside the live stage has a complete, working example.
import Avatar from '@/shared/components/Avatar';Live stage and code
The live component and its controls on the left, the code on the right; change a control and the code follows: Web TSX (the component in a working example), Tailwind and HTML (the markup it renders, with its data attributes), React Native, SwiftUI and Jetpack Compose. The header theme switch drives every stage.
Props
Read from the component's source when the docs build: names and defaults from its signature, types and descriptions from its JSDoc. A blank type means the prop has no JSDoc yet.
| Prop | Type | Default | Description |
|---|---|---|---|
name | - | - | - |
id | - | - | - |
imageUrl | - | null | - |
userId | - | null | - |
personnelId | - | null | - |
size | - | 'medium' | - |
shape | - | 'circle' | - |
presence | - | null | - |
onClick | - | - | - |
title | - | - | - |
className | - | '' | - |
...rest | - | - | Any other prop is passed through to the root element. |
Source: frontend/src/shared/components/Avatar/Avatar.js
DOM contract
What the rendered element carries: the data attributes its styles key on, its roles and ARIA, its focus style, and whether its stylesheet draws the 44px hit boundary. Also read from the source.
| Data attributes | None set by the component |
| Roles | Native element semantics only |
| ARIA | aria-label |
| Focus | Styles :focus-visible in its own stylesheet |
| 44px hit boundary | Yes: a ::after in Avatar.module.css |
Accessibility and touch
A pressable avatar takes the 44px target.
Avatars is passive: it reports a condition and is not pressed, so it has no hit boundary. If a design makes it pressable, it gains the 44 by 44 boundary and is marked /* ds-chip: why */.
Rules and constraints
Use it for
- Owners, assignees, contacts; a stack for a crew.
Avoid
- Never as decoration without a name nearby or in its tooltip.
Constraints
- Sizes 16 / 20 / 28 / 40; a circle for people, square for organisations.