Data display
Layout
Avatar
A circular or square image, or initials, that represents a person or an entity. Use it beside names in lists, comments and headers.
Install
import { Avatar } from 'vael-ui'Playground
AL
md
circle
bottom-end
Placement, behaviour and animation
Usage
<script setup lang="ts">
import { Avatar } from 'vael-ui'
</script>
<template>
<Avatar name="Ada Lovelace" />
</template>Motion New
Avatar: its parts' appearance, like the image fading in over the fallback.
<Avatar
:motion="{ initial: { root: { opacity: 0, y: 4 } } }"
/>| Name | Type | Description |
|---|---|---|
initialexit | rootimagefallbackbadge | Sets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate. |
enterleave | (parts, context) => animation | Animates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted. |
springdurationeasing | { damping, response } | number | string | Times all of it: a spring, or a duration in ms with an easing. Never both. |
false | boolean | Turns its motion off, for an animation of your own on its exposed elements. |
Accessibility
It has no keyboard interaction of its own.
- The image takes its
altfromalt, thenname. Without either,altis empty and screen readers skip the image. - The fallback (the initials or your default slot) is plain text. It shows while the image loads, or after it fails, and the hidden image is
aria-hidden, so the avatar is read once. - Avatar has no role and no keyboard handling. Content in the
#badgeslot is not hidden from screen readers.