Avatar
A person or entity, as a photo or initials.
Example
<focsd-avatar name="Amara Okafor"></focsd-avatar><focsd-avatar name="Lukas Brandt" size="l"></focsd-avatar><focsd-avatar name="Priya Raman" size="s"></focsd-avatar>Usage
Import the module once, then use the tag like any HTML element. Every framework below renders the same element; see Frameworks for setup.
<script type="module"> import '@focsd-dev/components/focsd-avatar.js';</script>
<focsd-avatar name="Amara Okafor"></focsd-avatar>import { Avatar } from '@focsd-dev/react';
export function Example() { return <Avatar name="Amara Okafor"></Avatar>;}<script setup>import '@focsd-dev/components/focsd-avatar.js';</script>
<template> <focsd-avatar name="Amara Okafor"></focsd-avatar></template>// Add CUSTOM_ELEMENTS_SCHEMA to the component's schemas, then:import '@focsd-dev/components/focsd-avatar.js';
// template<focsd-avatar name="Amara Okafor"></focsd-avatar><script> import '@focsd-dev/components/focsd-avatar.js';</script>
<focsd-avatar name="Amara Okafor"></focsd-avatar>API
Attributes
| Attribute | Property | Type | Default |
|---|---|---|---|
src | src | string | — |
name | name | string | — |
size | size | 's' | 'm' | 'l' | m |
decorative | decorative | boolean | false |
CSS parts
Style the inside of the component with ::part(), for example focsd-avatar::part(avatar).
| Part | Description |
|---|---|
avatar | The avatar element. |
image | The image element. |
initials | The initials shown when there is no image. |
Accessibility
role="img"named byname; falls back to initials when there is no image or it fails.- Add
decorativewhen the name is already shown next to it.
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.