md-avatar spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
A person or entity, as an image, initials, or a fallback glyph. It falls back on its own — image → initials → derived initials → a person icon — and picks a deterministic colour from the name so the same person keeps the same tile everywhere.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AC" name="Acme Corp" shape="rounded" label="Acme Corp"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper"></MdAvatar>
<MdAvatar initials="AC" name="Acme Corp" shape="rounded" label="Acme Corp"></MdAvatar>
<MdAvatar label="Unknown user"></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AC" name="Acme Corp" shape="rounded" label="Acme Corp"></md-avatar>
<md-avatar label="Unknown user"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AC" name="Acme Corp" shape="rounded" label="Acme Corp"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AC" name="Acme Corp" shape="rounded" label="Acme Corp"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-avatar in your project: Option A registers every AWC UI
component at once (simplest), Option B imports only this component for
tree-shake-friendly bundles.
<!-- ─── Option A: global registration (all components) ─── -->
<script type="module">
import '@awc-ui/core/define';
</script>
<!-- ─── Option B: single import (tree-shake only md-avatar) ─── -->
<script type="module">
import '@awc-ui/core/components/md-avatar';
</script>
<md-avatar></md-avatar>// ─── Option A: typed React wrapper (registers all components) ───
// Importing from '@awc-ui/react' calls defineCustomElements() as a
// side effect, so every md-* element becomes available in the browser.
import { MdAvatar } from '@awc-ui/react';
export function Example() {
return <MdAvatar></MdAvatar>;
}
// ─── Option B: single import (tree-shake to only md-avatar) ───
// Skip the wrapper and use the raw custom element. Smallest bundle,
// but you lose typed props/events on JSX.
import '@awc-ui/core/components/md-avatar';
export function ExampleTreeShaken() {
return <md-avatar></md-avatar>;
}// ─── Option A: schema module (any md-* element accepted) ───
// Pair with `defineCustomElements(window)` in main.ts.
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `<md-avatar></md-avatar>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-avatar'` in main.ts.
import { Component } from '@angular/core';
import { MdAvatar } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdAvatar],
template: `<md-avatar></md-avatar>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdAvatar } from '@awc-ui/vue';
</script>
<template>
<MdAvatar></MdAvatar>
</template>
<!-- ─── Option B: single import (tree-shake to only md-avatar) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-avatar';
</script>
<template>
<md-avatar></md-avatar>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-avatar></md-avatar>
<!-- ─── Option B: single import (tree-shake to only md-avatar) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-avatar';
</script>
<md-avatar></md-avatar>| Situation | Use instead |
|---|---|
| A decorative or content image | Plain <img> |
| An icon-only action | md-icon-button |
| A removable person token | md-chip with variant="input" |
| Presence state on its own | md-status-dot |
| A count marker | md-badge |
| A logo in an app bar | Plain <img> in the md-app-bar slot |
src (if it loads) → initials → initials derived from name → a generic
person icon. A 404 emits mdError and falls through automatically.
| Set | You get |
|---|---|
src that loads | The <img>, exposed as CSS part image |
src that 404s, plus initials | mdError, then the explicit initials |
src that 404s, plus name | mdError, then initials derived from name |
Neither initials nor name | The default slot, or the built-in person glyph |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Loads" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" initials="JD" label="John Doe"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" label="Unknown user"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar src="https://i.pravatar.cc/80?img=11" alt="Loads" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar src="https://broken.invalid/nope.png" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar src="https://broken.invalid/nope.png" initials="JD" label="John Doe"></MdAvatar>
<MdAvatar src="https://broken.invalid/nope.png" label="Unknown user"></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Loads" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" initials="JD" label="John Doe"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" label="Unknown user"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Loads" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" initials="JD" label="John Doe"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" label="Unknown user"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Loads" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" initials="JD" label="John Doe"></md-avatar>
<md-avatar src="https://broken.invalid/nope.png" label="Unknown user"></md-avatar><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="" name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=15" alt="" name="Alan Turing" shape="rounded" label="Alan Turing"></md-avatar>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'flex', gap: '20px', alignItems: 'center' }}>
<MdAvatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar src="https://i.pravatar.cc/80?img=32" alt="" name="Grace Hopper" label="Grace Hopper"></MdAvatar>
<MdAvatar src="https://i.pravatar.cc/80?img=15" alt="" name="Alan Turing" shape="rounded" label="Alan Turing"></MdAvatar>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="" name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=15" alt="" name="Alan Turing" shape="rounded" label="Alan Turing"></md-avatar>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="" name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=15" alt="" name="Alan Turing" shape="rounded" label="Alan Turing"></md-avatar>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="" name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=15" alt="" name="Alan Turing" shape="rounded" label="Alan Turing"></md-avatar>
</div><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Brewster Murray Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AT" label="Alan Turing"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more"></md-avatar>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'flex', gap: '20px', alignItems: 'center' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar name="Grace Brewster Murray Hopper" label="Grace Hopper"></MdAvatar>
<MdAvatar initials="AT" label="Alan Turing"></MdAvatar>
<MdAvatar initials="+5" colorFromName="false" label="Five more"></MdAvatar>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Brewster Murray Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AT" label="Alan Turing"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more"></md-avatar>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Brewster Murray Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AT" label="Alan Turing"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more"></md-avatar>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: flex; gap: 20px; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Brewster Murray Hopper" label="Grace Hopper"></md-avatar>
<md-avatar initials="AT" label="Alan Turing"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more"></md-avatar>
</div>| Value | Result |
|---|---|
small | 24×24 |
medium | Default. 40×40 |
large | 56×56 |
72 | 72px |
4rem, clamp(28px, 4vw, 72px) | Any CSS length |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar size="small" name="Ada Lovelace" label="Small"></md-avatar>
<md-avatar size="medium" name="Ada Lovelace" label="Medium"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Large"></md-avatar>
<md-avatar size="72" name="Ada Lovelace" label="72px"></md-avatar>
<md-avatar size="4rem" name="Ada Lovelace" label="4rem"></md-avatar>
<md-avatar size="clamp(28px, 4vw, 72px)" name="Ada Lovelace" label="Fluid"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar size="small" name="Ada Lovelace" label="Small"></MdAvatar>
<MdAvatar size="medium" name="Ada Lovelace" label="Medium"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Large"></MdAvatar>
<MdAvatar size="72" name="Ada Lovelace" label="72px"></MdAvatar>
<MdAvatar size="4rem" name="Ada Lovelace" label="4rem"></MdAvatar>
<MdAvatar size="clamp(28px, 4vw, 72px)" name="Ada Lovelace" label="Fluid"></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar size="small" name="Ada Lovelace" label="Small"></md-avatar>
<md-avatar size="medium" name="Ada Lovelace" label="Medium"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Large"></md-avatar>
<md-avatar size="72" name="Ada Lovelace" label="72px"></md-avatar>
<md-avatar size="4rem" name="Ada Lovelace" label="4rem"></md-avatar>
<md-avatar size="clamp(28px, 4vw, 72px)" name="Ada Lovelace" label="Fluid"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar size="small" name="Ada Lovelace" label="Small"></md-avatar>
<md-avatar size="medium" name="Ada Lovelace" label="Medium"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Large"></md-avatar>
<md-avatar size="72" name="Ada Lovelace" label="72px"></md-avatar>
<md-avatar size="4rem" name="Ada Lovelace" label="4rem"></md-avatar>
<md-avatar size="clamp(28px, 4vw, 72px)" name="Ada Lovelace" label="Fluid"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar size="small" name="Ada Lovelace" label="Small"></md-avatar>
<md-avatar size="medium" name="Ada Lovelace" label="Medium"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Large"></md-avatar>
<md-avatar size="72" name="Ada Lovelace" label="72px"></md-avatar>
<md-avatar size="4rem" name="Ada Lovelace" label="4rem"></md-avatar>
<md-avatar size="clamp(28px, 4vw, 72px)" name="Ada Lovelace" label="Fluid"></md-avatar>circle is the default and the right choice for people. Keep one shape per
entity type.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar shape="circle" src="https://i.pravatar.cc/80?img=11" alt="Circle" name="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" src="https://i.pravatar.cc/80?img=11" alt="Rounded" name="Ada Lovelace"></md-avatar>
<md-avatar shape="square" src="https://i.pravatar.cc/80?img=11" alt="Square" name="Ada Lovelace"></md-avatar>
<md-avatar shape="circle" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" name="Acme Corp" label="Acme Corp"></md-avatar>
<md-avatar shape="square" name="Beta Industries" label="Beta Industries"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar shape="circle" src="https://i.pravatar.cc/80?img=11" alt="Circle" name="Ada Lovelace"></MdAvatar>
<MdAvatar shape="rounded" src="https://i.pravatar.cc/80?img=11" alt="Rounded" name="Ada Lovelace"></MdAvatar>
<MdAvatar shape="square" src="https://i.pravatar.cc/80?img=11" alt="Square" name="Ada Lovelace"></MdAvatar>
<MdAvatar shape="circle" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar shape="rounded" name="Acme Corp" label="Acme Corp"></MdAvatar>
<MdAvatar shape="square" name="Beta Industries" label="Beta Industries"></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar shape="circle" src="https://i.pravatar.cc/80?img=11" alt="Circle" name="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" src="https://i.pravatar.cc/80?img=11" alt="Rounded" name="Ada Lovelace"></md-avatar>
<md-avatar shape="square" src="https://i.pravatar.cc/80?img=11" alt="Square" name="Ada Lovelace"></md-avatar>
<md-avatar shape="circle" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" name="Acme Corp" label="Acme Corp"></md-avatar>
<md-avatar shape="square" name="Beta Industries" label="Beta Industries"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar shape="circle" src="https://i.pravatar.cc/80?img=11" alt="Circle" name="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" src="https://i.pravatar.cc/80?img=11" alt="Rounded" name="Ada Lovelace"></md-avatar>
<md-avatar shape="square" src="https://i.pravatar.cc/80?img=11" alt="Square" name="Ada Lovelace"></md-avatar>
<md-avatar shape="circle" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" name="Acme Corp" label="Acme Corp"></md-avatar>
<md-avatar shape="square" name="Beta Industries" label="Beta Industries"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar shape="circle" src="https://i.pravatar.cc/80?img=11" alt="Circle" name="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" src="https://i.pravatar.cc/80?img=11" alt="Rounded" name="Ada Lovelace"></md-avatar>
<md-avatar shape="square" src="https://i.pravatar.cc/80?img=11" alt="Square" name="Ada Lovelace"></md-avatar>
<md-avatar shape="circle" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar shape="rounded" name="Acme Corp" label="Acme Corp"></md-avatar>
<md-avatar shape="square" name="Beta Industries" label="Beta Industries"></md-avatar>color-from-name is on by default. It hashes a seed into one of seven
palette slots, so the same person is the same colour on every screen. The seed
is the first non-empty of initials, name, label — so an avatar with only
initials, or only label, still gets a palette tile. Turn it off for a
uniform look — never randomise it per render, because the determinism is the
feature.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-avatar name="Katherine Johnson" label="Katherine Johnson"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds"></md-avatar>
<md-avatar name="Barbara Liskov" label="Barbara Liskov"></md-avatar>
<md-avatar name="Donald Knuth" label="Donald Knuth"></md-avatar>
<md-avatar name="Ada Lovelace" color-from-name="false" label="Uniform"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper"></MdAvatar>
<MdAvatar name="Alan Turing" label="Alan Turing"></MdAvatar>
<MdAvatar name="Katherine Johnson" label="Katherine Johnson"></MdAvatar>
<MdAvatar name="Linus Torvalds" label="Linus Torvalds"></MdAvatar>
<MdAvatar name="Barbara Liskov" label="Barbara Liskov"></MdAvatar>
<MdAvatar name="Donald Knuth" label="Donald Knuth"></MdAvatar>
<MdAvatar name="Ada Lovelace" colorFromName="false" label="Uniform"></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-avatar name="Katherine Johnson" label="Katherine Johnson"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds"></md-avatar>
<md-avatar name="Barbara Liskov" label="Barbara Liskov"></md-avatar>
<md-avatar name="Donald Knuth" label="Donald Knuth"></md-avatar>
<md-avatar name="Ada Lovelace" color-from-name="false" label="Uniform"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-avatar name="Katherine Johnson" label="Katherine Johnson"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds"></md-avatar>
<md-avatar name="Barbara Liskov" label="Barbara Liskov"></md-avatar>
<md-avatar name="Donald Knuth" label="Donald Knuth"></md-avatar>
<md-avatar name="Ada Lovelace" color-from-name="false" label="Uniform"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-avatar name="Katherine Johnson" label="Katherine Johnson"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds"></md-avatar>
<md-avatar name="Barbara Liskov" label="Barbara Liskov"></md-avatar>
<md-avatar name="Donald Knuth" label="Donald Knuth"></md-avatar>
<md-avatar name="Ada Lovelace" color-from-name="false" label="Uniform"></md-avatar>Initials are sliced from name in the string’s own script, so non-Latin names
work — but a two-character slice is often meaningless in CJK. Pass initials
explicitly there.
The default slot replaces the whole image / initials / icon stack.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar label="Starred" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-tertiary-container); --md-avatar-label-color: var(--md-sys-color-on-tertiary-container);">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-avatar>
<md-avatar label="Team emoji" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-secondary-container);">🚀</md-avatar>
<md-avatar shape="rounded" label="Custom mark" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);">
<span style="font-weight: 700; font-size: 14px;">AW</span>
</md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar label="Starred" colorFromName="false" style={{ '--md-avatar-container-color': 'var(--md-sys-color-tertiary-container)', '--md-avatar-label-color': 'var(--md-sys-color-on-tertiary-container)' }}>
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</MdAvatar>
<MdAvatar label="Team emoji" colorFromName="false" style={{ '--md-avatar-container-color': 'var(--md-sys-color-secondary-container)' }}>🚀</MdAvatar>
<MdAvatar shape="rounded" label="Custom mark" colorFromName="false" style={{ '--md-avatar-container-color': 'var(--md-sys-color-primary)', '--md-avatar-label-color': 'var(--md-sys-color-on-primary)' }}>
<span style={{ fontWeight: '700', fontSize: '14px' }}>AW</span>
</MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar label="Starred" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-tertiary-container); --md-avatar-label-color: var(--md-sys-color-on-tertiary-container);">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-avatar>
<md-avatar label="Team emoji" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-secondary-container);">🚀</md-avatar>
<md-avatar shape="rounded" label="Custom mark" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);">
<span style="font-weight: 700; font-size: 14px;">AW</span>
</md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar label="Starred" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-tertiary-container); --md-avatar-label-color: var(--md-sys-color-on-tertiary-container);">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-avatar>
<md-avatar label="Team emoji" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-secondary-container);">🚀</md-avatar>
<md-avatar shape="rounded" label="Custom mark" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);">
<span style="font-weight: 700; font-size: 14px;">AW</span>
</md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar label="Starred" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-tertiary-container); --md-avatar-label-color: var(--md-sys-color-on-tertiary-container);">
<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>
</md-avatar>
<md-avatar label="Team emoji" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-secondary-container);">🚀</md-avatar>
<md-avatar shape="rounded" label="Custom mark" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);">
<span style="font-weight: 700; font-size: 14px;">AW</span>
</md-avatar>Stack with a negative inline margin and a descending z-index. Each tile is
opaque, so the front avatar fully covers the one behind — the classic
“bite-mark” pattern. Over imagery, add a surface-coloured ring instead.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="z-index: 1;"></md-avatar>
</div>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ marginInlineEnd: '-12px', zIndex: '4' }}></MdAvatar>
<MdAvatar name="Linus Torvalds" label="Linus Torvalds" style={{ marginInlineEnd: '-12px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ marginInlineEnd: '-12px', zIndex: '2' }}></MdAvatar>
<MdAvatar initials="+5" colorFromName="false" label="5 more members" style={{ zIndex: '1' }}></MdAvatar>
</div>
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '4' }}></MdAvatar>
<MdAvatar name="Linus Torvalds" label="Linus Torvalds" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '2' }}></MdAvatar>
<MdAvatar initials="+5" colorFromName="false" label="5 more members" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', zIndex: '1' }}></MdAvatar>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="z-index: 1;"></md-avatar>
</div>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="z-index: 1;"></md-avatar>
</div>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="z-index: 1;"></md-avatar>
</div>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="5 more members" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>Outlined — a surface-coloured ring separates each tile
Blended — the ring picks up the surface behind the group
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; gap: 20px;">
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Outlined — a surface-coloured ring separates each tile</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Blended — the ring picks up the surface behind the group</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: var(--md-sys-color-surface-container-highest);">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gap: '20px' }}>
<div>
<p style={{ margin: '0 0 8px', font: '500 12px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>Outlined — a surface-coloured ring separates each tile</p>
<div style={{ display: 'inline-flex', alignItems: 'center', padding: '8px', borderRadius: '12px', background: 'linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container))' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '4' }}></MdAvatar>
<MdAvatar name="Linus Torvalds" label="Linus Torvalds" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '2' }}></MdAvatar>
<MdAvatar initials="+5" colorFromName="false" label="Five more" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface)', '--md-avatar-outline-width': '2px', zIndex: '1' }}></MdAvatar>
</div>
</div>
<div>
<p style={{ margin: '0 0 8px', font: '500 12px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>Blended — the ring picks up the surface behind the group</p>
<div style={{ display: 'inline-flex', alignItems: 'center', padding: '8px', borderRadius: '12px', background: 'var(--md-sys-color-surface-container-highest)' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface-container-highest)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Linus Torvalds" label="Linus Torvalds" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface-container-highest)', '--md-avatar-outline-width': '2px', marginInlineEnd: '-8px', zIndex: '2' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-surface-container-highest)', '--md-avatar-outline-width': '2px', zIndex: '1' }}></MdAvatar>
</div>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: grid; gap: 20px;">
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Outlined — a surface-coloured ring separates each tile</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Blended — the ring picks up the surface behind the group</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: var(--md-sys-color-surface-container-highest);">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: grid; gap: 20px;">
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Outlined — a surface-coloured ring separates each tile</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Blended — the ring picks up the surface behind the group</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: var(--md-sys-color-surface-container-highest);">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: grid; gap: 20px;">
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Outlined — a surface-coloured ring separates each tile</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-tertiary-container));">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 4;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar initials="+5" color-from-name="false" label="Five more" style="--md-avatar-outline-color: var(--md-sys-color-surface); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
<div>
<p style="margin: 0 0 8px; font: 500 12px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Blended — the ring picks up the surface behind the group</p>
<div style="display: inline-flex; align-items: center; padding: 8px; border-radius: 12px; background: var(--md-sys-color-surface-container-highest);">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 3;"></md-avatar>
<md-avatar name="Linus Torvalds" label="Linus Torvalds" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; margin-inline-end: -8px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="--md-avatar-outline-color: var(--md-sys-color-surface-container-highest); --md-avatar-outline-width: 2px; z-index: 1;"></md-avatar>
</div>
</div>
</div>In a real app the group comes from data: cap the visible members and roll the
rest into a +N tile whose color-from-name is off, so the counter never
borrows a person’s colour.
<div id="team" style="display: inline-flex; align-items: center;"></div>
<script type="module">
const members = [
{ name: 'Ada Lovelace', photo: '/u/ada.jpg' },
{ name: 'Linus Torvalds' },
{ name: 'Grace Hopper' },
{ name: 'Alan Turing' },
{ name: 'Barbara Liskov' },
];
const MAX = 3;
const visible = members.slice(0, MAX);
const remaining = members.length - visible.length;
const team = document.getElementById('team');
visible.forEach((m, i) => {
const a = document.createElement('md-avatar');
if (m.photo) a.src = m.photo;
a.name = m.name;
a.label = m.name;
a.style.marginInlineEnd = '-12px';
a.style.zIndex = String(visible.length - i + 1);
team.append(a);
});
if (remaining > 0) {
const more = document.createElement('md-avatar');
more.initials = '+' + remaining;
more.colorFromName = false;
more.label = remaining + ' more members';
team.append(more);
}
</script>import { MdAvatar } from '@awc-ui/react';
const MAX = 3;
type Member = { name: string; photo?: string };
export function AvatarGroup({ members }: { members: Member[] }) {
const visible = members.slice(0, MAX);
const remaining = members.length - visible.length;
return (
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
{visible.map((m, i) => (
<MdAvatar
key={m.name}
src={m.photo ?? ''}
name={m.name}
label={m.name}
style={{ marginInlineEnd: '-12px', zIndex: visible.length - i + 1 }}
/>
))}
{remaining > 0 && (
<MdAvatar
initials={'+' + remaining}
colorFromName={false}
label={remaining + ' more members'}
/>
)}
</div>
);
}import { Component, Input } from '@angular/core';
interface Member { name: string; photo?: string; }
@Component({
selector: 'app-avatar-group',
template: `
<div style="display: inline-flex; align-items: center;">
<md-avatar
*ngFor="let m of visible; let i = index"
[src]="m.photo || ''"
[name]="m.name"
[label]="m.name"
[style.margin-inline-end]="'-12px'"
[style.z-index]="visible.length - i + 1"
></md-avatar>
<md-avatar
*ngIf="remaining > 0"
[initials]="'+' + remaining"
[colorFromName]="false"
[label]="remaining + ' more members'"
></md-avatar>
</div>
`,
})
export class AvatarGroupComponent {
@Input() members: Member[] = [];
readonly max = 3;
get visible() { return this.members.slice(0, this.max); }
get remaining() { return this.members.length - this.visible.length; }
}<script setup lang="ts">
import { computed } from 'vue';
interface Member { name: string; photo?: string }
const props = defineProps<{ members: Member[] }>();
const MAX = 3;
const visible = computed(() => props.members.slice(0, MAX));
const remaining = computed(() => props.members.length - visible.value.length);
</script>
<template>
<div style="display: inline-flex; align-items: center;">
<md-avatar
v-for="(m, i) in visible"
:key="m.name"
:src="m.photo || ''"
:name="m.name"
:label="m.name"
:style="{ marginInlineEnd: '-12px', zIndex: visible.length - i + 1 }"
/>
<md-avatar
v-if="remaining > 0"
:initials="'+' + remaining"
color-from-name="false"
:label="remaining + ' more members'"
/>
</div>
</template><script lang="ts">
interface Member { name: string; photo?: string }
export let members: Member[] = [];
const MAX = 3;
$: visible = members.slice(0, MAX);
$: remaining = members.length - visible.length;
</script>
<div style="display: inline-flex; align-items: center;">
{#each visible as m, i (m.name)}
<md-avatar
src={m.photo || ''}
name={m.name}
label={m.name}
style="margin-inline-end: -12px; z-index: {visible.length - i + 1};"
/>
{/each}
{#if remaining > 0}
<md-avatar
initials={'+' + remaining}
color-from-name="false"
label={remaining + ' more members'}
/>
{/if}
</div>The avatar does not position a dot for you. Wrap both in a
position: relative host.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-status-dot state="away" label="Away"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-status-dot state="offline" label="Offline"></md-status-dot>
</span>import { MdAvatar, MdStatusDot } from '@awc-ui/react';
export function Demo() {
return (
<>
<span style={{ position: 'relative', display: 'inline-block' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdStatusDot state="online" label="Online"></MdStatusDot>
</span>
<span style={{ position: 'relative', display: 'inline-block' }}>
<MdAvatar name="Grace Hopper" label="Grace Hopper"></MdAvatar>
<MdStatusDot state="away" label="Away"></MdStatusDot>
</span>
<span style={{ position: 'relative', display: 'inline-block' }}>
<MdAvatar name="Alan Turing" label="Alan Turing"></MdAvatar>
<MdStatusDot state="offline" label="Offline"></MdStatusDot>
</span>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-status-dot state="away" label="Away"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-status-dot state="offline" label="Offline"></md-status-dot>
</span><script setup>
import '@awc-ui/core/define';
</script>
<template>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-status-dot state="away" label="Away"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-status-dot state="offline" label="Offline"></md-status-dot>
</span>
</template><script>
import '@awc-ui/core/define';
</script>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Grace Hopper" label="Grace Hopper"></md-avatar>
<md-status-dot state="away" label="Away"></md-status-dot>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Alan Turing" label="Alan Turing"></md-avatar>
<md-status-dot state="offline" label="Offline"></md-status-dot>
</span>md-list-item reuses this component for its leading
slot and runs the same fallback chain via leading-avatar,
leading-avatar-name and leading-avatar-label.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-list label="Team" style="inline-size: 100%; max-inline-size: 420px;">
<md-list-item type="button" headline="Ada Lovelace" supporting-text="ada@example.com" leading-avatar="https://i.pravatar.cc/80?img=47" leading-avatar-alt="Ada Lovelace"></md-list-item>
<md-list-item type="button" headline="Grace Hopper" supporting-text="grace@example.com" leading-avatar-name="Grace Hopper"></md-list-item>
<md-list-item type="button" headline="Alan Turing" supporting-text="alan@example.com" leading-avatar-name="Alan Turing"></md-list-item>
</md-list>import { MdList, MdListItem } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdList label="Team" style={{ inlineSize: '100%', maxInlineSize: '420px' }}>
<MdListItem type="button" headline="Ada Lovelace" supportingText="ada@example.com" leadingAvatar="https://i.pravatar.cc/80?img=47" leadingAvatarAlt="Ada Lovelace"></MdListItem>
<MdListItem type="button" headline="Grace Hopper" supportingText="grace@example.com" leadingAvatarName="Grace Hopper"></MdListItem>
<MdListItem type="button" headline="Alan Turing" supportingText="alan@example.com" leadingAvatarName="Alan Turing"></MdListItem>
</MdList>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-list label="Team" style="inline-size: 100%; max-inline-size: 420px;">
<md-list-item type="button" headline="Ada Lovelace" supporting-text="ada@example.com" leading-avatar="https://i.pravatar.cc/80?img=47" leading-avatar-alt="Ada Lovelace"></md-list-item>
<md-list-item type="button" headline="Grace Hopper" supporting-text="grace@example.com" leading-avatar-name="Grace Hopper"></md-list-item>
<md-list-item type="button" headline="Alan Turing" supporting-text="alan@example.com" leading-avatar-name="Alan Turing"></md-list-item>
</md-list><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-list label="Team" style="inline-size: 100%; max-inline-size: 420px;">
<md-list-item type="button" headline="Ada Lovelace" supporting-text="ada@example.com" leading-avatar="https://i.pravatar.cc/80?img=47" leading-avatar-alt="Ada Lovelace"></md-list-item>
<md-list-item type="button" headline="Grace Hopper" supporting-text="grace@example.com" leading-avatar-name="Grace Hopper"></md-list-item>
<md-list-item type="button" headline="Alan Turing" supporting-text="alan@example.com" leading-avatar-name="Alan Turing"></md-list-item>
</md-list>
</template><script>
import '@awc-ui/core/define';
</script>
<md-list label="Team" style="inline-size: 100%; max-inline-size: 420px;">
<md-list-item type="button" headline="Ada Lovelace" supporting-text="ada@example.com" leading-avatar="https://i.pravatar.cc/80?img=47" leading-avatar-alt="Ada Lovelace"></md-list-item>
<md-list-item type="button" headline="Grace Hopper" supporting-text="grace@example.com" leading-avatar-name="Grace Hopper"></md-list-item>
<md-list-item type="button" headline="Alan Turing" supporting-text="alan@example.com" leading-avatar-name="Alan Turing"></md-list-item>
</md-list>When the person’s name is already the adjacent text, the avatar is decorative.
Hide it by leaving label, alt and name empty — the component then
renders role="presentation" and aria-hidden="true" itself. Do not write
aria-hidden="true" on a labelled avatar: render() sets that attribute from
the resolved accessible name, so an author-set value is removed on the first
render whenever any of the three is present.
| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdLoad | yes | { src: string } | The image finished loading |
mdError | yes | { src: string } | The image failed; the component falls back |
Both are plain @Event() declarations, so they carry Stencil’s defaults —
bubbles, composed and cancelable. Nothing inside the component reads
defaultPrevented, though, so cancelling one changes nothing; it is a
side-effect of the default, not a control point.
interface MdAvatarEventDetail { /** The `src` that was being resolved when the event fired. */ src: string;}Both events bubble and cross shadow boundaries, so one listener on a container
covers a whole list. Press Reload both below: the first avatar re-fetches
and emits mdLoad; the second 404s and emits mdError. The fallback is
automatic but not yet painted when your listener runs — mdError is emitted
synchronously from the image’s error handler and the re-render is queued, so
the initials appear a tick later. Report the failure; don’t try to repair it.
<div id="roster">
<md-avatar src="/u/ada.jpg" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar src="/u/grace.jpg" name="Grace Hopper" label="Grace Hopper"></md-avatar>
</div>
<script type="module">
const roster = document.getElementById('roster');
roster.addEventListener('mdLoad', (e) => {
console.log('loaded', e.detail.src);
});
roster.addEventListener('mdError', (e) => {
// The avatar falls back on its own — just report it.
console.warn('avatar missing', e.detail.src);
});
</script>import { MdAvatar } from '@awc-ui/react';
type Member = { name: string; photo: string };
export function Roster({ members }: { members: Member[] }) {
const onLoad = (e: CustomEvent<{ src: string }>) => {
console.log('loaded', e.detail.src);
};
const onError = (e: CustomEvent<{ src: string }>) => {
// The avatar falls back on its own — just report it.
console.warn('avatar missing', e.detail.src);
};
return (
<div>
{members.map((m) => (
<MdAvatar
key={m.name}
src={m.photo}
name={m.name}
label={m.name}
onMdLoad={onLoad}
onMdError={onError}
/>
))}
</div>
);
}import { Component, Input } from '@angular/core';
interface Member { name: string; photo: string; }
@Component({
selector: 'app-roster',
template: `
<div>
<md-avatar
*ngFor="let m of members"
[src]="m.photo"
[name]="m.name"
[label]="m.name"
(mdLoad)="onLoad($event)"
(mdError)="onError($event)"
></md-avatar>
</div>
`,
})
export class RosterComponent {
@Input() members: Member[] = [];
onLoad(e: CustomEvent<{ src: string }>) {
console.log('loaded', e.detail.src);
}
onError(e: CustomEvent<{ src: string }>) {
// The avatar falls back on its own — just report it.
console.warn('avatar missing', e.detail.src);
}
}<script setup lang="ts">
interface Member { name: string; photo: string }
defineProps<{ members: Member[] }>();
function onLoad(e: CustomEvent<{ src: string }>) {
console.log('loaded', e.detail.src);
}
function onError(e: CustomEvent<{ src: string }>) {
// The avatar falls back on its own — just report it.
console.warn('avatar missing', e.detail.src);
}
</script>
<template>
<div>
<md-avatar
v-for="m in members"
:key="m.name"
:src="m.photo"
:name="m.name"
:label="m.name"
@mdLoad="onLoad"
@mdError="onError"
/>
</div>
</template><script lang="ts">
interface Member { name: string; photo: string }
export let members: Member[] = [];
function onLoad(e: CustomEvent<{ src: string }>) {
console.log('loaded', e.detail.src);
}
function onError(e: CustomEvent<{ src: string }>) {
// The avatar falls back on its own — just report it.
console.warn('avatar missing', e.detail.src);
}
</script>
<div>
{#each members as m (m.name)}
<md-avatar
src={m.photo}
name={m.name}
label={m.name}
on:mdLoad={onLoad}
on:mdError={onError}
/>
{/each}
</div>| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
src | src | string | '' | — |
alt | alt | string | '' | — |
name | name | string | '' | — |
initials | initials | string | '' | — |
size | size | MdAvatarSize | 'medium' | Yes |
shape | shape | MdAvatarShape | 'circle' | Yes |
label | label | string | '' | — |
colorFromName | color-from-name | boolean | true | Yes |
loading | loading | 'eager' | 'lazy' | 'lazy' | — |
crossorigin | crossorigin | '' | 'anonymous' | 'use-credentials' | '' | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
(default) | — |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-avatar-size | Square size of the host |
--md-avatar-container-color | Container fill (initials/icon mode) |
--md-avatar-container-shape | Border-radius override |
--md-avatar-label-color | Initials / icon color |
--md-avatar-label-font-family | Initials font family |
--md-avatar-label-font-size | Initials font size |
--md-avatar-label-font-weight | Initials font weight |
--md-avatar-icon-size | Icon glyph size |
--md-avatar-outline-color | Optional outline color |
--md-avatar-outline-width | Optional outline width (default 0) |
--md-avatar-label-letter-spacing | — |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
image | The `<img>` element (image mode) |
initials | The initials text element |
icon | The fallback person icon |
label)
or it is decorative beside the name. Both are correct; doing neither, or
both, is not.label → alt → name. When all three are
empty the host renders role="presentation" and aria-hidden="true", which
is exactly what you want next to a row that already says the name.role="img" with that string as
aria-label, and the inner <img> is aria-hidden so the name is announced
once.alt describes the image; label is the accessible name of the
avatar. They are not the same slot.loading="lazy" is the default; use eager only above the fold.crossorigin for CDN images you intend to read from a canvas, or you get
a tainted canvas.Walk the four rows below with a screen reader: only the first three are
announced at all, and the fourth — initials with no label, alt or name —
is silent by construction.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">label</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">role="img", announced as "Ada Lovelace"</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">alt</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="Grace Hopper"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label — alt becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">name</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Alan Turing"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label or alt — name becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">none</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="BL"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Barbara Liskov — role="presentation", the avatar stays silent</span>
</div>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '6rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>label</span>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>role="img", announced as "Ada Lovelace"</span>
</div>
<span style={{ inlineSize: '6rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>alt</span>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar src="https://i.pravatar.cc/80?img=32" alt="Grace Hopper"></MdAvatar>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>no label — alt becomes the accessible name</span>
</div>
<span style={{ inlineSize: '6rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>name</span>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar name="Alan Turing"></MdAvatar>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>no label or alt — name becomes the accessible name</span>
</div>
<span style={{ inlineSize: '6rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>none</span>
<div style={{ display: 'flex', gap: '12px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar initials="BL"></MdAvatar>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>Barbara Liskov — role="presentation", the avatar stays silent</span>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">label</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">role="img", announced as "Ada Lovelace"</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">alt</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="Grace Hopper"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label — alt becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">name</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Alan Turing"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label or alt — name becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">none</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="BL"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Barbara Liskov — role="presentation", the avatar stays silent</span>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">label</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">role="img", announced as "Ada Lovelace"</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">alt</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="Grace Hopper"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label — alt becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">name</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Alan Turing"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label or alt — name becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">none</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="BL"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Barbara Liskov — role="presentation", the avatar stays silent</span>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">label</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">role="img", announced as "Ada Lovelace"</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">alt</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar src="https://i.pravatar.cc/80?img=32" alt="Grace Hopper"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label — alt becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">name</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar name="Alan Turing"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">no label or alt — name becomes the accessible name</span>
</div>
<span style="inline-size: 6rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">none</span>
<div style="display: flex; gap: 12px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="BL"></md-avatar>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">Barbara Liskov — role="presentation", the avatar stays silent</span>
</div>
</div>RTL — the avatar itself is symmetric and needs nothing. What moves is
everything attached to it: an md-status-dot
anchors with inset-inline-end / inset-block-end, and a group stacked with
margin-inline-end lays itself out from the right. Write both with logical
properties and the same markup works in both directions. See
RTL.
<span style="position: relative; display: inline-flex;"> <md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar> <md-status-dot state="online" label="Online"></md-status-dot></span><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">ltr</span>
<div dir="ltr" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">rtl</span>
<div dir="rtl" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
</div>import { MdAvatar, MdStatusDot } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>ltr</span>
<div dir="ltr" style={{ display: 'flex', gap: '24px', alignItems: 'center', flexWrap: 'wrap' }}>
<span style={{ position: 'relative', display: 'inline-flex' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdStatusDot state="online" label="Online"></MdStatusDot>
</span>
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ marginInlineEnd: '-12px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Alan Turing" label="Alan Turing" style={{ marginInlineEnd: '-12px', zIndex: '2' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ zIndex: '1' }}></MdAvatar>
</div>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>rtl</span>
<div dir="rtl" style={{ display: 'flex', gap: '24px', alignItems: 'center', flexWrap: 'wrap' }}>
<span style={{ position: 'relative', display: 'inline-flex' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdStatusDot state="online" label="Online"></MdStatusDot>
</span>
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" style={{ marginInlineEnd: '-12px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="Alan Turing" label="Alan Turing" style={{ marginInlineEnd: '-12px', zIndex: '2' }}></MdAvatar>
<MdAvatar name="Grace Hopper" label="Grace Hopper" style={{ zIndex: '1' }}></MdAvatar>
</div>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">ltr</span>
<div dir="ltr" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">rtl</span>
<div dir="rtl" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">ltr</span>
<div dir="ltr" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">rtl</span>
<div dir="rtl" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">ltr</span>
<div dir="ltr" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">rtl</span>
<div dir="rtl" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-status-dot state="online" label="Online"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace" style="margin-inline-end: -12px; z-index: 3;"></md-avatar>
<md-avatar name="Alan Turing" label="Alan Turing" style="margin-inline-end: -12px; z-index: 2;"></md-avatar>
<md-avatar name="Grace Hopper" label="Grace Hopper" style="z-index: 1;"></md-avatar>
</div>
</div>
</div>The dot places itself with logical insets, and the built-in
--md-status-dot-inset-end hook is logical too. Reach past it for a physical
right and the pip lands on the wrong corner the moment the page flips —
both rows below are under dir="rtl".
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div dir="rtl" style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">correct</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">logical insets — the pip follows the text direction</span>
</div>
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">wrong</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آلان تورنغ" label="آلان تورنغ"></md-avatar>
<md-status-dot state="busy" label="مشغول" style="inset-inline-end: auto; right: -2px;"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">a physical right: pinned to the wrong corner</span>
</div>
</div>import { MdAvatar, MdStatusDot } from '@awc-ui/react';
export function Demo() {
return (
<>
<div dir="rtl" style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>correct</span>
<div style={{ display: 'flex', gap: '24px', alignItems: 'center', flexWrap: 'wrap' }}>
<span style={{ position: 'relative', display: 'inline-flex' }}>
<MdAvatar name="آدا لوفلايس" label="آدا لوفلايس"></MdAvatar>
<MdStatusDot state="online" label="متصل"></MdStatusDot>
</span>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>logical insets — the pip follows the text direction</span>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>wrong</span>
<div style={{ display: 'flex', gap: '24px', alignItems: 'center', flexWrap: 'wrap' }}>
<span style={{ position: 'relative', display: 'inline-flex' }}>
<MdAvatar name="آلان تورنغ" label="آلان تورنغ"></MdAvatar>
<MdStatusDot state="busy" label="مشغول" style={{ insetInlineEnd: 'auto', right: '-2px' }}></MdStatusDot>
</span>
<span style={{ font: '400 13px system-ui, sans-serif', color: 'var(--md-sys-color-on-surface-variant)' }}>a physical right: pinned to the wrong corner</span>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div dir="rtl" style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">correct</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">logical insets — the pip follows the text direction</span>
</div>
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">wrong</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آلان تورنغ" label="آلان تورنغ"></md-avatar>
<md-status-dot state="busy" label="مشغول" style="inset-inline-end: auto; right: -2px;"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">a physical right: pinned to the wrong corner</span>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div dir="rtl" style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">correct</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">logical insets — the pip follows the text direction</span>
</div>
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">wrong</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آلان تورنغ" label="آلان تورنغ"></md-avatar>
<md-status-dot state="busy" label="مشغول" style="inset-inline-end: auto; right: -2px;"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">a physical right: pinned to the wrong corner</span>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div dir="rtl" style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">correct</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">logical insets — the pip follows the text direction</span>
</div>
<span style="inline-size: 4.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">wrong</span>
<div style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap;">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آلان تورنغ" label="آلان تورنغ"></md-avatar>
<md-status-dot state="busy" label="مشغول" style="inset-inline-end: auto; right: -2px;"></md-status-dot>
</span>
<span style="font: 400 13px system-ui, sans-serif; color: var(--md-sys-color-on-surface-variant);">a physical right: pinned to the wrong corner</span>
</div>
</div><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">default</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-1</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-2</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-3</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-4</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">48px</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>default</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="small" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>-1</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-1"></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" density="-1"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-1"></MdAvatar>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>-2</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-2"></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" density="-2"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-2"></MdAvatar>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>-3</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-3"></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" density="-3"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-3"></MdAvatar>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>-4</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-4"></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace" density="-4"></MdAvatar>
<MdAvatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-4"></MdAvatar>
</div>
<span style={{ inlineSize: '3.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace, monospace' }}>48px</span>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar size="48px" name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-2"></MdAvatar>
<MdAvatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-4"></MdAvatar>
</div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">default</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-1</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-2</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-3</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-4</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">48px</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">default</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-1</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-2</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-3</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-4</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">48px</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center;">
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">default</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-1</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-1"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-2</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-3</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-3"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">-4</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="small" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
<md-avatar size="large" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
<span style="inline-size: 3.5rem; opacity: .65; font-size: .75rem; font-family: ui-monospace, monospace;">48px</span>
<div style="display: flex; gap: 16px; align-items: center; flex-wrap: wrap;">
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-2"></md-avatar>
<md-avatar size="48px" name="Ada Lovelace" label="Ada Lovelace" density="-4"></md-avatar>
</div>
</div><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--md-sys-color-surface-container-low);">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" style="margin-inline-end: -10px; z-index: 3;"></md-avatar>
<md-avatar name="آلان تورنغ" label="آلان تورنغ" style="margin-inline-end: -10px; z-index: 2;"></md-avatar>
<md-avatar name="غريس هوبر" label="غريس هوبر" style="z-index: 1;"></md-avatar>
</div>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" density="-4"></md-avatar>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" size="40px"></md-avatar>
</div>import { MdAvatar, MdStatusDot } from '@awc-ui/react';
export function Demo() {
return (
<>
<div dir="rtl" data-density="-2" style={{ display: 'flex', gap: '24px', alignItems: 'center', flexWrap: 'wrap', padding: '12px', borderRadius: '12px', background: 'var(--md-sys-color-surface-container-low)' }}>
<span style={{ position: 'relative', display: 'inline-flex' }}>
<MdAvatar name="آدا لوفلايس" label="آدا لوفلايس"></MdAvatar>
<MdStatusDot state="online" label="متصل"></MdStatusDot>
</span>
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<MdAvatar name="آدا لوفلايس" label="آدا لوفلايس" style={{ marginInlineEnd: '-10px', zIndex: '3' }}></MdAvatar>
<MdAvatar name="آلان تورنغ" label="آلان تورنغ" style={{ marginInlineEnd: '-10px', zIndex: '2' }}></MdAvatar>
<MdAvatar name="غريس هوبر" label="غريس هوبر" style={{ zIndex: '1' }}></MdAvatar>
</div>
<MdAvatar name="آدا لوفلايس" label="آدا لوفلايس" density="-4"></MdAvatar>
<MdAvatar name="آدا لوفلايس" label="آدا لوفلايس" size="40px"></MdAvatar>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div dir="rtl" data-density="-2" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--md-sys-color-surface-container-low);">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" style="margin-inline-end: -10px; z-index: 3;"></md-avatar>
<md-avatar name="آلان تورنغ" label="آلان تورنغ" style="margin-inline-end: -10px; z-index: 2;"></md-avatar>
<md-avatar name="غريس هوبر" label="غريس هوبر" style="z-index: 1;"></md-avatar>
</div>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" density="-4"></md-avatar>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" size="40px"></md-avatar>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div dir="rtl" data-density="-2" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--md-sys-color-surface-container-low);">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" style="margin-inline-end: -10px; z-index: 3;"></md-avatar>
<md-avatar name="آلان تورنغ" label="آلان تورنغ" style="margin-inline-end: -10px; z-index: 2;"></md-avatar>
<md-avatar name="غريس هوبر" label="غريس هوبر" style="z-index: 1;"></md-avatar>
</div>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" density="-4"></md-avatar>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" size="40px"></md-avatar>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div dir="rtl" data-density="-2" style="display: flex; gap: 24px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--md-sys-color-surface-container-low);">
<span style="position: relative; display: inline-flex;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس"></md-avatar>
<md-status-dot state="online" label="متصل"></md-status-dot>
</span>
<div style="display: inline-flex; align-items: center;">
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" style="margin-inline-end: -10px; z-index: 3;"></md-avatar>
<md-avatar name="آلان تورنغ" label="آلان تورنغ" style="margin-inline-end: -10px; z-index: 2;"></md-avatar>
<md-avatar name="غريس هوبر" label="غريس هوبر" style="z-index: 1;"></md-avatar>
</div>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" density="-4"></md-avatar>
<md-avatar name="آدا لوفلايس" label="آدا لوفلايس" size="40px"></md-avatar>
</div>Density — density="-1…-4" (or a data-density ancestor) shrinks the
preset sizes by driving --md-sys-density-scale. An explicit CSS length in
size writes --md-avatar-size directly and is unaffected — that is the last
avatar above, sitting at 40px inside a -2 container.
A local rung wins over the inherited global one, because
:host([density='-1']) … :host([density='-4']) land the custom property
directly on the host. density="0" is not a rung. There is deliberately no
[density="0"] rule anywhere in the token layer — reflected props write
density="0" onto nearly every element, so such a rule would pin density-0 on
everything and break global inheritance. Absence of a rung means “inherit
whatever the ancestor says”, so density="0" inside data-density="-2" still
renders at -2. To opt a single avatar out of an inherited rung, pin its
size to a CSS length. See Density.
i18n — initials derived from name follow the string’s own script via
Intl.Segmenter, so non-Latin names work; check that a two-character slice is
meaningful in your locales (it usually isn’t for CJK — pass initials there).
Translate label and alt.
| Custom property | Purpose | Default |
|---|---|---|
--md-avatar-size | Box size | 40px, tapers with density |
--md-avatar-container-color | Tile background | Name-derived palette slot |
--md-avatar-container-shape | Corner radius | Per shape |
--md-avatar-label-color | Initials colour | Palette slot label |
--md-avatar-label-font-family / -font-size / -font-weight / -letter-spacing | Initials typography | Font size is 40% of the box |
--md-avatar-icon-size | Fallback glyph | 60% of the box |
--md-avatar-outline-color / --md-avatar-outline-width | Ring | none |
--md-avatar-palette-1-container … -7-container (and -label) | Name-derived palette | Tonal set |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-avatar name="Ada Lovelace" label="Ringed" style="--md-avatar-outline-color: var(--md-sys-color-primary); --md-avatar-outline-width: 3px;"></md-avatar>
<md-avatar name="Ada Lovelace" label="Branded" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);"></md-avatar>
<md-avatar name="Ada Lovelace" label="Squared" shape="rounded" style="--md-avatar-container-shape: 6px; --md-avatar-size: 56px;"></md-avatar>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdAvatar name="Ada Lovelace" label="Ringed" style={{ '--md-avatar-outline-color': 'var(--md-sys-color-primary)', '--md-avatar-outline-width': '3px' }}></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Branded" colorFromName="false" style={{ '--md-avatar-container-color': 'var(--md-sys-color-primary)', '--md-avatar-label-color': 'var(--md-sys-color-on-primary)' }}></MdAvatar>
<MdAvatar name="Ada Lovelace" label="Squared" shape="rounded" style={{ '--md-avatar-container-shape': '6px', '--md-avatar-size': '56px' }}></MdAvatar>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-avatar name="Ada Lovelace" label="Ringed" style="--md-avatar-outline-color: var(--md-sys-color-primary); --md-avatar-outline-width: 3px;"></md-avatar>
<md-avatar name="Ada Lovelace" label="Branded" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);"></md-avatar>
<md-avatar name="Ada Lovelace" label="Squared" shape="rounded" style="--md-avatar-container-shape: 6px; --md-avatar-size: 56px;"></md-avatar><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-avatar name="Ada Lovelace" label="Ringed" style="--md-avatar-outline-color: var(--md-sys-color-primary); --md-avatar-outline-width: 3px;"></md-avatar>
<md-avatar name="Ada Lovelace" label="Branded" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);"></md-avatar>
<md-avatar name="Ada Lovelace" label="Squared" shape="rounded" style="--md-avatar-container-shape: 6px; --md-avatar-size: 56px;"></md-avatar>
</template><script>
import '@awc-ui/core/define';
</script>
<md-avatar name="Ada Lovelace" label="Ringed" style="--md-avatar-outline-color: var(--md-sys-color-primary); --md-avatar-outline-width: 3px;"></md-avatar>
<md-avatar name="Ada Lovelace" label="Branded" color-from-name="false" style="--md-avatar-container-color: var(--md-sys-color-primary); --md-avatar-label-color: var(--md-sys-color-on-primary);"></md-avatar>
<md-avatar name="Ada Lovelace" label="Squared" shape="rounded" style="--md-avatar-container-shape: 6px; --md-avatar-size: 56px;"></md-avatar>--md-avatar-container-color and --md-avatar-label-color are read only by the
base :host rule, which the palette rule out-specifies — so they take effect
only when color-from-name is false (or the seed is empty). Everything else
in the table above (--md-avatar-size, -container-shape, -outline-*,
-icon-size, the typography hooks) is unaffected by the palette; the palette
itself is retinted through --md-avatar-palette-N-container / -label.
The name-derived palette is tuned per theme, so check any override in both.
CSS parts — image (the <img>), initials (the text span) and icon
(the built-in person glyph). Each is reachable from the light DOM with
::part(), which is how you restyle the inside without touching the tokens.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<style>
.avatar-parts-demo md-avatar::part(initials) {
font-variant-numeric: tabular-nums;
letter-spacing: .06em;
}
.avatar-parts-demo md-avatar::part(image) {
filter: grayscale(1) contrast(1.05);
}
.avatar-parts-demo md-avatar::part(icon) {
opacity: .55;
}
</style>
<div class="avatar-parts-demo" style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="18" name="Eighteen" label="18 open items"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
</div>import { MdAvatar } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.avatar-parts-demo md-avatar::part(initials) {
font-variant-numeric: tabular-nums;
letter-spacing: .06em;
}
.avatar-parts-demo md-avatar::part(image) {
filter: grayscale(1) contrast(1.05);
}
.avatar-parts-demo md-avatar::part(icon) {
opacity: .55;
}
</style>
<div className="avatar-parts-demo" style={{ display: 'flex', gap: '20px', alignItems: 'center', flexWrap: 'wrap' }}>
<MdAvatar initials="18" name="Eighteen" label="18 open items"></MdAvatar>
<MdAvatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdAvatar label="Unknown user"></MdAvatar>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<style>
.avatar-parts-demo md-avatar::part(initials) {
font-variant-numeric: tabular-nums;
letter-spacing: .06em;
}
.avatar-parts-demo md-avatar::part(image) {
filter: grayscale(1) contrast(1.05);
}
.avatar-parts-demo md-avatar::part(icon) {
opacity: .55;
}
</style>
<div class="avatar-parts-demo" style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="18" name="Eighteen" label="18 open items"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<style>
.avatar-parts-demo md-avatar::part(initials) {
font-variant-numeric: tabular-nums;
letter-spacing: .06em;
}
.avatar-parts-demo md-avatar::part(image) {
filter: grayscale(1) contrast(1.05);
}
.avatar-parts-demo md-avatar::part(icon) {
opacity: .55;
}
</style>
<div class="avatar-parts-demo" style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="18" name="Eighteen" label="18 open items"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<style>
.avatar-parts-demo md-avatar::part(initials) {
font-variant-numeric: tabular-nums;
letter-spacing: .06em;
}
.avatar-parts-demo md-avatar::part(image) {
filter: grayscale(1) contrast(1.05);
}
.avatar-parts-demo md-avatar::part(icon) {
opacity: .55;
}
</style>
<div class="avatar-parts-demo" style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap;">
<md-avatar initials="18" name="Eighteen" label="18 open items"></md-avatar>
<md-avatar src="https://i.pravatar.cc/80?img=11" alt="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-avatar label="Unknown user"></md-avatar>
</div>md-avatar::part(initials) { font-variant-numeric: tabular-nums;}md-status-dot ·
md-badge ·
md-chip ·
md-list-item ·
md-organization-chart ·
md-app-bar
md-avatarTwo artefacts to give your AI agent so it generates correct UI with this component. The per-component spec answers "how do I use this exact tag?". The main-llm spec answers "which tag should I pick in the first place?".
md-avatar spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
System-prompt preamble · decision matrix · token reference · page recipes · anti-patterns. Paste into the system prompt at the start of a piece of work.