Avatars are used to show a thumbnail representation of an individual or business in the interface.
<script lang="ts" setup>
import { Avatar } from '@returnless/focus-ui';
</script>
<template>
<Avatar name="John Doe" />
</template><script lang="ts" setup>
import { Avatar } from '@returnless/focus-ui';
</script>
<template>
<Avatar name="John Doe" initials="JD" />
</template><script lang="ts" setup>
import { Avatar } from '@returnless/focus-ui';
</script>
<template>
<Avatar name="John Doe" size="xs" />
<Avatar name="John Doe" size="sm" />
<Avatar name="John Doe" size="md" />
<Avatar name="John Doe" size="lg" />
<Avatar name="John Doe" size="xl" />
// Or with initials...
<Avatar name="John Doe" size="xs" initials="JD" />
<Avatar name="John Doe" size="sm" initials="JD" />
<Avatar name="John Doe" size="md" initials="JD" />
<Avatar name="John Doe" size="lg" initials="JD" />
<Avatar name="John Doe" size="xl" initials="JD" />
</template>Avatars should be one of 5 sizes:
Any time you use an image to communicate a concept in the interface, it's important to use descriptive alt text. Doing this is important for accessibility because it allows screen readers to describe what's in the image to people who may not be able to see it.
For avatars, we recommend using a format that describes what will show in the image:
alt=Person's name" if the avatar represents a personalt=Company name" if the avatar represents a businessalt="" if the name of the person/business appears next to the avatar as textThe avatar component represents content, and should have a text equivalent for users using assistive technologies. By default, the value of the name prop is used for the alternative text. If different text would be more accurate, use the accessibilityLabel prop to replace the value provided by name.