This documentation is under construction. Pages can be missing or change at any time. Follow it on GitHub.

Skip to content

Avatar

An easily stylable avatar component.

API reference#

Import the components of the family:

use function Phem\Ui\{Avatar, AvatarImage, AvatarFallback};

Avatar#

An image of a user with a fallback, such as the initials: Base UI Avatar.Root, on the phem-avatar controller. The fallback shows while the image is not loaded.

PropTypeDefault
children?Htmlnull
...restmixed—

AvatarImage#

The image. It shows only when it loads.

PropTypeDefault
src (required)string—
altstring''
...restmixed—

AvatarFallback#

The text that shows while the image is not loaded. With a delay (in ms), it shows only after this time, so a fast image does not show it: the server render has it hidden.

PropTypeDefault
delayint0
children?Htmlnull
...restmixed—

The source of the examples: examples/ui/Avatar.phem.

Phem
Esc
↑↓ to navigate↵ to openEsc to close