Skip to content

Avatar

A small account image that falls back to the account’s initials.

<script>
import Avatar from "@invisible-ui/svelte/Avatar.svelte";
</script>

In Elements:

<ds-avatar name="Ada Lovelace" src="/ada.png" size="lg"></ds-avatar>
PropTypeDefaultDescription
name *string—Provides the accessible name and the initials fallback.
srcstring | undefinedundefinedImage URL; when absent or it fails to load, initials are shown.
altstring | undefinedundefinedAccessible name; defaults to name.
size"sm" | "md" | "lg""md"Avatar size.
shape"circle" | "square""circle"Avatar shape.

The image src is rendered as given: pass only URLs you trust or have sanitized. See Security.

  • Exposed as a single image (role="img" + aria-label), so it reads the same whether the photo or initials show.
<Avatar name="Ada Lovelace" src="/ada.jpg" size="lg" />

In React:

<Avatar name="Ada Lovelace" src="/ada.jpg" size="lg" />

Themeable via --ds-avatar-*.