Avatar
Image with initials when the picture is missing.
When to use
Use Avatar when you need image with initials when the picture is missing.
Import
TypeScript
import { Avatar } from '@gzodo/ui'Avatar uses img, not a framework image component. If src is missing or fails to load, fallback is shown. A string fallback becomes initials from the first letters of the name. color sets the fallback background and picks a contrasting text color.
Examples
5ALGU
Initials
Two words become two letters. A single word becomes one letter.
ALALALAL
Sizes
sm, md, lg, and xl. Default is md.
GUA
Color
color is the fallback background. Text is black or white based on the luminance of that color.
ALU
Rounded
rounded uses a full pill radius instead of the default squircle.
Image
src shows the image. If it fails, the component falls back to initials. alt is the image accessible name.
Avatar
7Avatar
Property
Description
Type
Default
srcImage URL.
string—
altAccessible name of the image.
string—
fallbackShown without an image. Strings become initials.
ReactNode—
sizeDiameter of the avatar.
'sm' | 'md' | 'lg' | 'xl''md'colorFallback background. Text contrast is derived from it.
string—
roundedPill shape instead of the default radius.
booleanfalseclassNameExtra classes on the root.
string—