import { Avatar } from "@wfp/react"
In this example, the Avatar
component displays the image from the provided URL.
<Avatar image="user-image-url.jpg" name="John Doe" alt="John Doe's Avatar" />
image
prop is not provided and missingImage
is set to "avatar", a default user icon is displayed.image
prop is undefined and missingImage
is "letter", an SVG with the user's initial letter is rendered.image
prop is provided, it is displayed as the user's avatar.prefix
obtained from the useSettings
hook. This prefix is prepended to various CSS class names for consistent styling across the design system.alt
prop should be used to provide descriptive alternative text for the avatar image, enhancing accessibility for screen reader users.missingImage
propIf the URL is not available, it falls back to the default user icon.
<Avatar alt="User's name" missingImage="avatar" name="Jane Doe" />;
In this case the alt
text the user's name "Albert Doe" is used for generating the initial in the fallback letter mode.
<Avatar alt="User's name" missingImage="letter" name="Albert Doe" />;