Fallback
When src
or srcSet
are missing or fail to load, a fallback will be displayed. By default this will show the user initials, based on the name
. Optionally you can supply your own content using the default children
. This can be used to display icons or implement a custom image using @sveltejs/enhanced-img.
Filters
Avatars can implement SVG Filters using arbitrary Tailwind syntax.
Style Attribute
Use the style
prop to implement custom styles on the parent <figure>
element.
Anatomy
<Avatar>
image
fallback
API Reference
Avatar
Property | Type | Description |
---|---|---|
src | string | |
srcset | string | |
name * | string | |
base | string | |
background | string | |
size | string | |
font | string | |
border | string | |
rounded | string | |
shadow | string | |
classes | string | |
imageBase | string | |
imageClasses | string | |
fallbackBase | string | |
fallbackClasses | string | |
children | Snippet<[]> | |
ids | Partial<{ root: string; image: string; fallback: string; }> | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |
onStatusChange | (details: StatusChangeDetails) => void | |
style | string | |