md-badge 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 small count or marker attached to another element. Two sizes: a small
dot meaning “something is here”, and a large pill carrying a number or a
glyph.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="chat" variant="standard" aria-label="Messages, 1284 unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="warning" variant="standard" aria-label="Alerts, action required">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<MdBadge value="5"></MdBadge>
</MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="Notifications, new activity">
<MdBadge variant="small"></MdBadge>
</MdIconButton>
<MdIconButton icon="chat" variant="standard" aria-label="Messages, 1284 unread">
<MdBadge value="1284" max="99"></MdBadge>
</MdIconButton>
<MdIconButton icon="warning" variant="standard" aria-label="Alerts, action required">
<MdBadge icon="priority_high"></MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="chat" variant="standard" aria-label="Messages, 1284 unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="warning" variant="standard" aria-label="Alerts, action required">
<md-badge icon="priority_high"></md-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="chat" variant="standard" aria-label="Messages, 1284 unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="warning" variant="standard" aria-label="Alerts, action required">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="chat" variant="standard" aria-label="Messages, 1284 unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="warning" variant="standard" aria-label="Alerts, action required">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-badge 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-badge) ─── -->
<script type="module">
import '@awc-ui/core/components/md-badge';
</script>
<md-badge></md-badge>// ─── 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 { MdBadge } from '@awc-ui/react';
export function Example() {
return <MdBadge></MdBadge>;
}
// ─── Option B: single import (tree-shake to only md-badge) ───
// 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-badge';
export function ExampleTreeShaken() {
return <md-badge></md-badge>;
}// ─── 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-badge></md-badge>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-badge'` in main.ts.
import { Component } from '@angular/core';
import { MdBadge } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdBadge],
template: `<md-badge></md-badge>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdBadge } from '@awc-ui/vue';
</script>
<template>
<MdBadge></MdBadge>
</template>
<!-- ─── Option B: single import (tree-shake to only md-badge) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-badge';
</script>
<template>
<md-badge></md-badge>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-badge></md-badge>
<!-- ─── Option B: single import (tree-shake to only md-badge) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-badge';
</script>
<md-badge></md-badge>| Situation | Use instead |
|---|---|
| Presence / online status | md-status-dot |
| An interactive filter or tag | md-chip |
| A standalone status label | md-chip, non-interactive |
| Progress toward completion | md-progress-indicator |
| A count that is the main content, not an annotation | Plain text |
| Anything the user should click | md-button / md-icon-button |
md-icon-button is already position: relative,
so nesting a badge inside one just works. Anything else you position yourself.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">home</span>
<md-badge variant="small"></md-badge>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-badge value="3"></md-badge>
</span>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">notifications</span>
<md-badge value="9" style="--md-badge-offset-x: -2px; --md-badge-offset-y: 2px;"></md-badge>
</span>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdAvatar, MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<MdBadge value="5"></MdBadge>
</MdIconButton>
<span style={{ position: 'relative', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', inlineSize: '40px', blockSize: '40px' }}>
<span className="material-symbols-outlined" aria-hidden="true">home</span>
<MdBadge variant="small"></MdBadge>
</span>
<span style={{ position: 'relative', display: 'inline-block' }}>
<MdAvatar name="Ada Lovelace" label="Ada Lovelace"></MdAvatar>
<MdBadge value="3"></MdBadge>
</span>
<span style={{ position: 'relative', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', inlineSize: '40px', blockSize: '40px' }}>
<span className="material-symbols-outlined" aria-hidden="true">notifications</span>
<MdBadge value="9" style={{ '--md-badge-offset-x': '-2px', '--md-badge-offset-y': '2px' }}></MdBadge>
</span>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">home</span>
<md-badge variant="small"></md-badge>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-badge value="3"></md-badge>
</span>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">notifications</span>
<md-badge value="9" style="--md-badge-offset-x: -2px; --md-badge-offset-y: 2px;"></md-badge>
</span><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">home</span>
<md-badge variant="small"></md-badge>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-badge value="3"></md-badge>
</span>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">notifications</span>
<md-badge value="9" style="--md-badge-offset-x: -2px; --md-badge-offset-y: 2px;"></md-badge>
</span>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 5 unread">
<md-badge value="5"></md-badge>
</md-icon-button>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">home</span>
<md-badge variant="small"></md-badge>
</span>
<span style="position: relative; display: inline-block;">
<md-avatar name="Ada Lovelace" label="Ada Lovelace"></md-avatar>
<md-badge value="3"></md-badge>
</span>
<span style="position: relative; display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px;">
<span class="material-symbols-outlined" aria-hidden="true">notifications</span>
<md-badge value="9" style="--md-badge-offset-x: -2px; --md-badge-offset-y: 2px;"></md-badge>
</span>Fine-tune with --md-badge-offset-x / --md-badge-offset-y. The defaults are
50% / -50% — a percentage of the badge’s own box, so the count grows away
from the anchor.
| Variant | Renders | Carries a number |
|---|---|---|
small | A 6px dot | No — value is ignored by design |
large | Default. A 16px pill | Yes |
M3’s advice: small where space is tight (app bars, so the dot can’t hit the
screen edge), large where collisions aren’t an issue (a navigation rail).
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, 7 unread">
<md-badge variant="large" value="7"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" value="7"></md-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="notifications" variant="standard" aria-label="Notifications, new activity">
<MdBadge variant="small"></MdBadge>
</MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="Notifications, 7 unread">
<MdBadge variant="large" value="7"></MdBadge>
</MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="Notifications, new activity">
<MdBadge variant="small" value="7"></MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, 7 unread">
<md-badge variant="large" value="7"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" value="7"></md-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, 7 unread">
<md-badge variant="large" value="7"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" value="7"></md-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, 7 unread">
<md-badge variant="large" value="7"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" value="7"></md-badge>
</md-icon-button>maxCounts and string labels both work — the badge sizes to its content either way.
max defaults to 999. Above it the badge renders "{max}+"; it does not
clamp value itself, so value still holds the true number for you to read
back.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 1 unread">
<md-badge value="1"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 42 unread">
<md-badge value="42"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 999 unread">
<md-badge value="999"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over a thousand unread">
<md-badge value="1284"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over ninety-nine unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Draft">
<md-badge value="NEW"></md-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 1 unread">
<MdBadge value="1"></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 42 unread">
<MdBadge value="42"></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 999 unread">
<MdBadge value="999"></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, over a thousand unread">
<MdBadge value="1284"></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, over ninetyNine unread">
<MdBadge value="1284" max="99"></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Draft">
<MdBadge value="NEW"></MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="mail" variant="standard" aria-label="Inbox, 1 unread">
<md-badge value="1"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 42 unread">
<md-badge value="42"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 999 unread">
<md-badge value="999"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over a thousand unread">
<md-badge value="1284"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over ninety-nine unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Draft">
<md-badge value="NEW"></md-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 1 unread">
<md-badge value="1"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 42 unread">
<md-badge value="42"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 999 unread">
<md-badge value="999"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over a thousand unread">
<md-badge value="1284"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over ninety-nine unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Draft">
<md-badge value="NEW"></md-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 1 unread">
<md-badge value="1"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 42 unread">
<md-badge value="42"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 999 unread">
<md-badge value="999"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over a thousand unread">
<md-badge value="1284"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, over ninety-nine unread">
<md-badge value="1284" max="99"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Draft">
<md-badge value="NEW"></md-badge>
</md-icon-button>value is a string, so short text labels work — but keep them to a few
characters or the pill will collide with whatever sits beside it.
icon takes a Material Symbols glyph name. The icon slot replaces it for a
custom SVG.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
<md-icon-button icon="task_alt" variant="standard" aria-label="Task complete">
<md-badge icon="check"></md-badge>
</md-icon-button>
<md-icon-button icon="download" variant="standard" aria-label="Download in progress">
<md-badge icon="arrow_downward"></md-badge>
</md-icon-button>
<md-icon-button icon="star" variant="standard" aria-label="Starred, custom marker">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" width="8" height="8" 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-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error">
<MdBadge icon="priority_high"></MdBadge>
</MdIconButton>
<MdIconButton icon="task_alt" variant="standard" aria-label="Task complete">
<MdBadge icon="check"></MdBadge>
</MdIconButton>
<MdIconButton icon="download" variant="standard" aria-label="Download in progress">
<MdBadge icon="arrow_downward"></MdBadge>
</MdIconButton>
<MdIconButton icon="star" variant="standard" aria-label="Starred, custom marker">
<MdBadge>
<svg slot="icon" viewBox="0 0 24 24" width="8" height="8" 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>
</MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="cloud" variant="standard" aria-label="Sync error">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
<md-icon-button icon="task_alt" variant="standard" aria-label="Task complete">
<md-badge icon="check"></md-badge>
</md-icon-button>
<md-icon-button icon="download" variant="standard" aria-label="Download in progress">
<md-badge icon="arrow_downward"></md-badge>
</md-icon-button>
<md-icon-button icon="star" variant="standard" aria-label="Starred, custom marker">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" width="8" height="8" 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-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
<md-icon-button icon="task_alt" variant="standard" aria-label="Task complete">
<md-badge icon="check"></md-badge>
</md-icon-button>
<md-icon-button icon="download" variant="standard" aria-label="Download in progress">
<md-badge icon="arrow_downward"></md-badge>
</md-icon-button>
<md-icon-button icon="star" variant="standard" aria-label="Starred, custom marker">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" width="8" height="8" 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-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error">
<md-badge icon="priority_high"></md-badge>
</md-icon-button>
<md-icon-button icon="task_alt" variant="standard" aria-label="Task complete">
<md-badge icon="check"></md-badge>
</md-icon-button>
<md-icon-button icon="download" variant="standard" aria-label="Download in progress">
<md-badge icon="arrow_downward"></md-badge>
</md-icon-button>
<md-icon-button icon="star" variant="standard" aria-label="Starred, custom marker">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" width="8" height="8" 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-badge>
</md-icon-button>Anything slotted into icon replaces the glyph — an inline SVG, or plain text
such as an emoji. You do not need to set icon as well; a bare md-badge
with slotted content renders it.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="favorite" variant="standard" aria-label="Favourites, starred">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" 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-badge>
</md-icon-button>
<md-icon-button icon="security" variant="standard" aria-label="Security, protected">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>
</md-badge>
</md-icon-button>
<md-icon-button icon="local_fire_department" variant="standard" aria-label="Trending">
<md-badge>
<span slot="icon">🔥</span>
</md-badge>
</md-icon-button>
<md-icon-button icon="bolt" variant="standard" aria-label="Boosted">
<md-badge>
<span slot="icon">⚡</span>
</md-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="favorite" variant="standard" aria-label="Favourites, starred">
<MdBadge>
<svg slot="icon" viewBox="0 0 24 24" 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>
</MdBadge>
</MdIconButton>
<MdIconButton icon="security" variant="standard" aria-label="Security, protected">
<MdBadge>
<svg slot="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>
</MdBadge>
</MdIconButton>
<MdIconButton icon="local_fire_department" variant="standard" aria-label="Trending">
<MdBadge>
<span slot="icon">🔥</span>
</MdBadge>
</MdIconButton>
<MdIconButton icon="bolt" variant="standard" aria-label="Boosted">
<MdBadge>
<span slot="icon">⚡</span>
</MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="favorite" variant="standard" aria-label="Favourites, starred">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" 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-badge>
</md-icon-button>
<md-icon-button icon="security" variant="standard" aria-label="Security, protected">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>
</md-badge>
</md-icon-button>
<md-icon-button icon="local_fire_department" variant="standard" aria-label="Trending">
<md-badge>
<span slot="icon">🔥</span>
</md-badge>
</md-icon-button>
<md-icon-button icon="bolt" variant="standard" aria-label="Boosted">
<md-badge>
<span slot="icon">⚡</span>
</md-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="favorite" variant="standard" aria-label="Favourites, starred">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" 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-badge>
</md-icon-button>
<md-icon-button icon="security" variant="standard" aria-label="Security, protected">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>
</md-badge>
</md-icon-button>
<md-icon-button icon="local_fire_department" variant="standard" aria-label="Trending">
<md-badge>
<span slot="icon">🔥</span>
</md-badge>
</md-icon-button>
<md-icon-button icon="bolt" variant="standard" aria-label="Boosted">
<md-badge>
<span slot="icon">⚡</span>
</md-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="favorite" variant="standard" aria-label="Favourites, starred">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" 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-badge>
</md-icon-button>
<md-icon-button icon="security" variant="standard" aria-label="Security, protected">
<md-badge>
<svg slot="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4z"/></svg>
</md-badge>
</md-icon-button>
<md-icon-button icon="local_fire_department" variant="standard" aria-label="Trending">
<md-badge>
<span slot="icon">🔥</span>
</md-badge>
</md-icon-button>
<md-icon-button icon="bolt" variant="standard" aria-label="Boosted">
<md-badge>
<span slot="icon">⚡</span>
</md-badge>
</md-icon-button>Slotted icons are sized and coloured from the badge’s own tokens —
--md-badge-icon-size and --md-badge-icon-color are applied to the slotted
element, so drop any width/height/fill attributes and let the badge
scale it (that is also what keeps it shrinking with density). Give the SVG a
viewBox so it scales, and mark it aria-hidden — the count belongs in the
host’s accessible name.
md-navigation-tab and
md-navigation-rail-tab carry their own
badge / badge-value / badge-max props, so you don’t nest an md-badge
inside them.
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-navigation-bar style="inline-size: 100%;">
<md-navigation-tab label="Home" icon="home" active></md-navigation-tab>
<md-navigation-tab label="Mail" icon="mail" badge badge-value="12"></md-navigation-tab>
<md-navigation-tab label="Alerts" icon="notifications" badge></md-navigation-tab>
<md-navigation-tab label="Profile" icon="person"></md-navigation-tab>
</md-navigation-bar>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdNavigationBar, MdNavigationTab } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdNavigationBar style={{ inlineSize: '100%' }}>
<MdNavigationTab label="Home" icon="home" active></MdNavigationTab>
<MdNavigationTab label="Mail" icon="mail" badge badgeValue="12"></MdNavigationTab>
<MdNavigationTab label="Alerts" icon="notifications" badge></MdNavigationTab>
<MdNavigationTab label="Profile" icon="person"></MdNavigationTab>
</MdNavigationBar>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-navigation-bar style="inline-size: 100%;">
<md-navigation-tab label="Home" icon="home" active></md-navigation-tab>
<md-navigation-tab label="Mail" icon="mail" badge badge-value="12"></md-navigation-tab>
<md-navigation-tab label="Alerts" icon="notifications" badge></md-navigation-tab>
<md-navigation-tab label="Profile" icon="person"></md-navigation-tab>
</md-navigation-bar><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-navigation-bar style="inline-size: 100%;">
<md-navigation-tab label="Home" icon="home" active></md-navigation-tab>
<md-navigation-tab label="Mail" icon="mail" badge badge-value="12"></md-navigation-tab>
<md-navigation-tab label="Alerts" icon="notifications" badge></md-navigation-tab>
<md-navigation-tab label="Profile" icon="person"></md-navigation-tab>
</md-navigation-bar>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-navigation-bar style="inline-size: 100%;">
<md-navigation-tab label="Home" icon="home" active></md-navigation-tab>
<md-navigation-tab label="Mail" icon="mail" badge badge-value="12"></md-navigation-tab>
<md-navigation-tab label="Alerts" icon="notifications" badge></md-navigation-tab>
<md-navigation-tab label="Profile" icon="person"></md-navigation-tab>
</md-navigation-bar>md-badge has no events and nothing focusable. It is decoration plus text.
If the count needs to be actionable, make the host interactive.
| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
variant | variant | 'small' | 'large' | 'large' | Yes |
value | value | string | '' | — |
max | max | number | 999 | — |
icon | icon | string | '' | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
icon | — |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-badge-container-color | — |
--md-badge-label-color | — |
--md-badge-container-shape | — |
--md-badge-icon-color | — |
--md-badge-icon-size | — |
--md-badge-offset-x | — |
--md-badge-offset-y | — |
--md-badge-large-height | — |
--md-badge-large-padding | — |
--md-badge-small-size | — |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
icon | — |
label | — |
See the accessibility story for the announced output.
The badge is visual only. Screen-reader users get the count from the host
control’s accessible name — aria-label="Inbox, 5 unread" — and you must
keep it in sync when the count changes.
btn.setAttribute('aria-label', 'Inbox, ' + count + ' unread');badge.value = String(count);If the count updates live and matters, put it in a live region rather than relying on the badge repainting.
Keep contrast ≥ 3:1 for the container and label if you override the colours.
Nothing in the badge is focusable, so it never appears in the tab order — that’s intentional.
In Storybook: RTL mirrors the anchor offset, and
localization formats the count with Intl.
density (0 to −4) shrinks the badge, its label and its glyph in step, and
inherits from a global data-density ancestor — so a badge inside a compact
toolbar tightens with it rather than staying full size.
RTL — M3 requires the badge to move to the mirrored corner. The offsets are custom properties, so set them per direction:
[dir="rtl"] md-badge { --md-badge-offset-x: 6px;}See RTL.
Density — density="-1…-4" shrinks the badge: 16 → 15 → 14 → 13 → 12px
tall, with the label and glyph scaling alongside, so a three-digit pill narrows
from ~28px to ~21px. Set it on the badge and its host together — a badge that
keeps full size on a tightened button drifts off the corner. Check that your
longest value still fits at the rung you ship.
See Density.
Count
Dot (variant=small)
Glyph
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Count</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="0"><md-badge value="128" density="0"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-1"><md-badge value="128" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-2"><md-badge value="128" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-3"><md-badge value="128" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-4"><md-badge value="128" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Dot (variant=small)</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="0"><md-badge variant="small" density="0"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-1"><md-badge variant="small" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-2"><md-badge variant="small" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-3"><md-badge variant="small" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-4"><md-badge variant="small" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Glyph</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="0"><md-badge icon="priority_high" density="0"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-1"><md-badge icon="priority_high" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-2"><md-badge icon="priority_high" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-3"><md-badge icon="priority_high" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-4"><md-badge icon="priority_high" density="-4"></md-badge></md-icon-button>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<p style={{ margin: '0 0 8px', font: '500 12px/1.2 system-ui, sans-serif', letterSpacing: '.04em', textTransform: 'uppercase', color: 'var(--md-sys-color-on-surface-variant)' }}>Count</p>
<div style={{ display: 'flex', gap: '20px', alignItems: 'center', flexWrap: 'wrap', marginBlockEnd: '24px' }}>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="0"><MdBadge value="128" density="0"></MdBadge></MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-1"><MdBadge value="128" density="-1"></MdBadge></MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-2"><MdBadge value="128" density="-2"></MdBadge></MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-3"><MdBadge value="128" density="-3"></MdBadge></MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-4"><MdBadge value="128" density="-4"></MdBadge></MdIconButton>
</div>
<p style={{ margin: '0 0 8px', font: '500 12px/1.2 system-ui, sans-serif', letterSpacing: '.04em', textTransform: 'uppercase', color: 'var(--md-sys-color-on-surface-variant)' }}>Dot (variant=small)</p>
<div style={{ display: 'flex', gap: '20px', alignItems: 'center', flexWrap: 'wrap', marginBlockEnd: '24px' }}>
<MdIconButton icon="notifications" variant="standard" aria-label="New activity" density="0"><MdBadge variant="small" density="0"></MdBadge></MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="New activity" density="-1"><MdBadge variant="small" density="-1"></MdBadge></MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="New activity" density="-2"><MdBadge variant="small" density="-2"></MdBadge></MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="New activity" density="-3"><MdBadge variant="small" density="-3"></MdBadge></MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="New activity" density="-4"><MdBadge variant="small" density="-4"></MdBadge></MdIconButton>
</div>
<p style={{ margin: '0 0 8px', font: '500 12px/1.2 system-ui, sans-serif', letterSpacing: '.04em', textTransform: 'uppercase', color: 'var(--md-sys-color-on-surface-variant)' }}>Glyph</p>
<div style={{ display: 'flex', gap: '20px', alignItems: 'center', flexWrap: 'wrap', marginBlockEnd: '24px' }}>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error" density="0"><MdBadge icon="priority_high" density="0"></MdBadge></MdIconButton>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error" density="-1"><MdBadge icon="priority_high" density="-1"></MdBadge></MdIconButton>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error" density="-2"><MdBadge icon="priority_high" density="-2"></MdBadge></MdIconButton>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error" density="-3"><MdBadge icon="priority_high" density="-3"></MdBadge></MdIconButton>
<MdIconButton icon="cloud" variant="standard" aria-label="Sync error" density="-4"><MdBadge icon="priority_high" density="-4"></MdBadge></MdIconButton>
</div>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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 -->
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Count</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="0"><md-badge value="128" density="0"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-1"><md-badge value="128" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-2"><md-badge value="128" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-3"><md-badge value="128" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-4"><md-badge value="128" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Dot (variant=small)</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="0"><md-badge variant="small" density="0"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-1"><md-badge variant="small" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-2"><md-badge variant="small" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-3"><md-badge variant="small" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-4"><md-badge variant="small" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Glyph</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="0"><md-badge icon="priority_high" density="0"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-1"><md-badge icon="priority_high" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-2"><md-badge icon="priority_high" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-3"><md-badge icon="priority_high" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-4"><md-badge icon="priority_high" density="-4"></md-badge></md-icon-button>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Count</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="0"><md-badge value="128" density="0"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-1"><md-badge value="128" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-2"><md-badge value="128" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-3"><md-badge value="128" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-4"><md-badge value="128" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Dot (variant=small)</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="0"><md-badge variant="small" density="0"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-1"><md-badge variant="small" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-2"><md-badge variant="small" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-3"><md-badge variant="small" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-4"><md-badge variant="small" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Glyph</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="0"><md-badge icon="priority_high" density="0"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-1"><md-badge icon="priority_high" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-2"><md-badge icon="priority_high" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-3"><md-badge icon="priority_high" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-4"><md-badge icon="priority_high" density="-4"></md-badge></md-icon-button>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Count</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="0"><md-badge value="128" density="0"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-1"><md-badge value="128" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-2"><md-badge value="128" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-3"><md-badge value="128" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 128 unread" density="-4"><md-badge value="128" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Dot (variant=small)</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="0"><md-badge variant="small" density="0"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-1"><md-badge variant="small" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-2"><md-badge variant="small" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-3"><md-badge variant="small" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="New activity" density="-4"><md-badge variant="small" density="-4"></md-badge></md-icon-button>
</div>
<p style="margin: 0 0 8px; font: 500 12px/1.2 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant);">Glyph</p>
<div style="display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-block-end: 24px;">
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="0"><md-badge icon="priority_high" density="0"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-1"><md-badge icon="priority_high" density="-1"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-2"><md-badge icon="priority_high" density="-2"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-3"><md-badge icon="priority_high" density="-3"></md-badge></md-icon-button>
<md-icon-button icon="cloud" variant="standard" aria-label="Sync error" density="-4"><md-badge icon="priority_high" density="-4"></md-badge></md-icon-button>
</div>i18n — format numerals with Intl.NumberFormat before assigning them
to value, for locales with different digit systems. The + overflow marker
is not localizable.
In Storybook: dark theme and custom CSS.
| Custom property | Purpose | Default |
|---|---|---|
--md-badge-container-color | Pill / dot background | error |
--md-badge-label-color | Label colour | on-error |
--md-badge-container-shape | Corner radius | corner-full |
--md-badge-icon-color / --md-badge-icon-size | Glyph badge | Inherits label / ~10px |
--md-badge-offset-x / --md-badge-offset-y | Position relative to the host | 50% / -50% |
--md-badge-large-height / --md-badge-large-padding | Large-pill geometry | 16px |
--md-badge-small-size | Dot diameter | 6px |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-color: var(--md-sys-color-primary); --md-badge-label-color: var(--md-sys-color-on-primary);"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-shape: 4px;"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" style="--md-badge-small-size: 10px; --md-badge-container-color: var(--md-sys-color-tertiary);"></md-badge>
</md-icon-button>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdBadge, MdIconButton } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<MdBadge value="8" style={{ '--md-badge-container-color': 'var(--md-sys-color-primary)', '--md-badge-label-color': 'var(--md-sys-color-on-primary)' }}></MdBadge>
</MdIconButton>
<MdIconButton icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<MdBadge value="8" style={{ '--md-badge-container-shape': '4px' }}></MdBadge>
</MdIconButton>
<MdIconButton icon="notifications" variant="standard" aria-label="Notifications, new activity">
<MdBadge variant="small" style={{ '--md-badge-small-size': '10px', '--md-badge-container-color': 'var(--md-sys-color-tertiary)' }}></MdBadge>
</MdIconButton>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// 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-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-color: var(--md-sys-color-primary); --md-badge-label-color: var(--md-sys-color-on-primary);"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-shape: 4px;"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" style="--md-badge-small-size: 10px; --md-badge-container-color: var(--md-sys-color-tertiary);"></md-badge>
</md-icon-button><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-color: var(--md-sys-color-primary); --md-badge-label-color: var(--md-sys-color-on-primary);"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-shape: 4px;"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" style="--md-badge-small-size: 10px; --md-badge-container-color: var(--md-sys-color-tertiary);"></md-badge>
</md-icon-button>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-color: var(--md-sys-color-primary); --md-badge-label-color: var(--md-sys-color-on-primary);"></md-badge>
</md-icon-button>
<md-icon-button icon="mail" variant="standard" aria-label="Inbox, 8 unread">
<md-badge value="8" style="--md-badge-container-shape: 4px;"></md-badge>
</md-icon-button>
<md-icon-button icon="notifications" variant="standard" aria-label="Notifications, new activity">
<md-badge variant="small" style="--md-badge-small-size: 10px; --md-badge-container-color: var(--md-sys-color-tertiary);"></md-badge>
</md-icon-button>CSS parts — icon, label.
md-badge::part(label) { font-variant-numeric: tabular-nums;}md-status-dot ·
md-chip ·
md-icon-button ·
md-navigation-bar ·
md-navigation-rail ·
md-avatar ·
md-progress-indicator
md-badgeTwo 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-badge 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.