- Accordion
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Checkbox
- Combobox
- Container
- CurrencyInput
- DistributionSlider
- Drawer
- Dropdown
- Grid
- Heading
- Image
- Input
- InputGroup
- Label
- Logo
- MapPin
- Modal
- NativeSelect
- NumberInput
- OtpInput
- PhoneInput
- Popover
- Progress
- PropertyCalendar
- RadioGroup
- RadioGroupCards
- ResponsiveModal
- ScrollArea
- SearchBar
- SearchBarFallback
- SearchInput
- Select
- Separator
- Spinner
- Switch
- Tabs
- Text
- Textarea
- Toast
- Toggle
- ToggleGroup
- Tooltip
Avatar
User profile image with automatic fallback handling
pnpm add @wandercom/design-system-web
The Avatar component displays a user profile image with automatic fallback handling. When an image is unavailable or fails to load, fallback text is auto-generated from the fullName prop (using the first letter). If no fullName is provided, it defaults to "W".
import { Avatar } from '@wandercom/design-system-web/ui/avatar';
export function Example() {
return (
<Avatar
src="https://avatars.githubusercontent.com/u/6477234?v=4"
alt="User profile"
fullName="John Doe"
/>
);
}Loading example...
<Avatar
size="sm"
src="https://avatars.githubusercontent.com/u/6477234?v=4"
alt="User"
fullName="User"
/>src
string
Image source URL.
alt
string
Alternative text for the image.
fullName
string
Full name of the user. Used for accessibility and to auto-generate fallback initials when image is unavailable. Defaults to 'W' if not provided.
size
'sm' | 'md' | 'lg'
Size variant. Defaults to 'md'.
slots
{ root?: string, image?: string, fallback?: string }
Custom CSS classes for component slots.