The name or identifier used to generate the avatar.
Optional
options: AvatarOptionsOptional customization settings for the avatar.
Defines the options for generating an SVG avatar.
Optional
backgroundColor?: stringThe background color of the avatar (e.g., '#FF6600'). If not provided, a color will be deterministically generated from the username.
Optional
fontFamily?: stringThe font family for the initials. Defaults to 'Arial, sans-serif'.
Optional
fontSize?: numberThe font size for the initials. If not provided, it will be calculated based on avatar size.
Optional
height?: numberThe height of the avatar in pixels. Defaults to 100.
Optional
initialsLength?: numberThe maximum number of initials to display. Defaults to 2.
Optional
shape?: AvatarShapeThe shape of the avatar. Defaults to 'square'.
Optional
svgAttributes?: { [key: string]: string }Additional SVG attributes to apply to the root
Optional
text?: stringText to explicitly display on the avatar instead of generated initials.
If provided, initialsLength
and username-based initial generation will be ignored.
Optional
textColor?: stringThe color of the text (initials) on the avatar (e.g., '#FFFFFF'). If not provided, a contrasting color will be chosen based on the background.
Optional
width?: numberThe width of the avatar in pixels. Defaults to 100.
The generated avatar SVG as a string.
Generates an SVG avatar based on the provided username and customization options.