enes

Avatar

An Avatar is a graphical representation of a user, team, or entity.

Avatar can display an image, icon, or initials, and supports different sizes, shapes, and status indicators.

Usage

<script>
	import { Avatar } from 'fluentui-svelte';
</script>

<Avatar size={40} name="FluentUI Svelte" />

Image

An avatar can display an image. It is recommended to also include a name in addition to the image: the initials from the name are displayed while the image is loading, and the name makes the Avatar accessible to screen readers.

Icon

An avatar can display an icon. The icon will only be shown when there is no image or initials available.

Badge

An avatar can have a badge to indicate presence status. See the PresenceBadge component for more info.

Shape

An avatar can have a square, circular, or rounded shape.

Color: colorful

An avatar can have its color automatically picked based on the name prop, or idForColor can be used if a name is not available.

Component Props

NameTypeDefaultDescription
namestring'Avatar'The name of the person or entity represented by this Avatar. This should always be provided if it is available.
image{ src: string; }The Avatar's image
ref bindableHTMLDivElementThe DOM reference of the avatar element.
sizenumber48Size of the avatar in pixels.
shape'circular' | 'rounded' | 'square''circular'The avatar can have a circular, rounded or square shape.
colorColors | 'colorful''attention'The color when displaying either an icon or initials. For now it only supports system colors (plus colorful).
active'active' | 'inactive'Optional activity indicator
activeAppearance'ring' | 'shadow' | 'ring-shadow''ring'The appearance when `active="active"`
initialsstringnameCustom initials by default they will be derived from the `name` prop.
idForColorstringSpecify a string to be used instead of the name, to determine which color to use when color="colorful".
iconSnippet | ComponentIcon to be displayed when the avatar doesn't have an image or initials.
badgeBadgePresenceThe badge to display as a status indicator. (you can use with a custom icon)
HTML Attributes