Capítulo 12 de 43
An image element with a built-in fallback for representing a user — handles the load/error states images need but native <img> doesn't expose cleanly.
Root → Image + Fallback.Image: renders only once loaded by default; onLoadingStatusChange gives finer control if needed.Fallback: renders while loading or on error; accepts any children (initials, icon, skeleton). delayMs defers its render to avoid a flash for fast connections.import { Avatar, Tooltip } from "radix-ui";
<Tooltip.Root>
<Tooltip.Trigger>
<Avatar.Root>
<Avatar.Image src="..." />
<Avatar.Fallback delayMs={600}>JD</Avatar.Fallback>
</Avatar.Root>
</Tooltip.Trigger>
<Tooltip.Content side="top">Tooltip content<Tooltip.Arrow /></Tooltip.Content>
</Tooltip.Root>
delayMs to skip the fallback flash on fast connections.Fallback's delayMs (e.g. 400-600ms) to avoid a jarring flash-of-fallback on fast networks where the image loads almost instantly.Fallback covers both the loading state and the error state (broken image URL) with one element — no separate error handling needed.Root/child structure like everything else in the library.