← All Components
<mth-avatar>
User or entity avatar supporting image loading with error fallback to computed initials or default silhouette, shape presets, and presence status.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-avatar>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/avatar"></script>
<mth-avatar size="xs" shape="circle">Example</mth-avatar>import '@methane-ui/ui/avatar';
import '@methane-ui/react';
export function Example() {
return <mth-avatar size="xs" shape="circle">Example</mth-avatar>;
}<script setup lang="ts">
import '@methane-ui/ui/avatar';
</script>
<template>
<mth-avatar size="xs" shape="circle">Example</mth-avatar>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/avatar';
import { MthAvatarDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthAvatarDirective],
template: `<mth-avatar size="xs" shape="circle">Example</mth-avatar>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/avatar';
import MthAvatar from '@methane-ui/svelte/MthAvatar.svelte';
</script>
<MthAvatar size="xs" shape="circle">Example</MthAvatar>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
src | src | string | "" | Image URL for the avatar. |
alt | alt | string | "" | Alternative text describing the avatar image. |
name | name | string | "" | Full name used to compute initials fallback and accessible label. |
size | size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | "md" | Avatar dimension preset (xs | sm | md | lg | xl). |
shape | shape | 'circle' | 'square' | "circle" | Avatar frame geometry (circle | square). |
status | status | '' | 'online' | 'busy' | 'away' | 'offline' | "" | Optional presence status indicator (online | busy | away | offline). |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| states | Exposes ElementInternals CustomStateSet flags: :state(loaded), :state(error). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |