md-fab 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.
The single most prominent action on a screen. Floats above the UI in six colour mappings and three sizes, and morphs between an icon-only circle and an extended pill that carries a label.
<!-- 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-fab icon="add" aria-label="Create"></md-fab>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab variant="primary" size="large" icon="add" aria-label="Create"></md-fab>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdFab icon="add" aria-label="Create"></MdFab>
<MdFab icon="edit" label="Compose"></MdFab>
<MdFab variant="primary" size="large" icon="add" aria-label="Create"></MdFab>
</>
);
}// 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-fab icon="add" aria-label="Create"></md-fab>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab variant="primary" size="large" icon="add" aria-label="Create"></md-fab><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab variant="primary" size="large" icon="add" aria-label="Create"></md-fab>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab variant="primary" size="large" icon="add" aria-label="Create"></md-fab>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-fab 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-fab) ─── -->
<script type="module">
import '@awc-ui/core/components/md-fab';
</script>
<md-fab></md-fab>// ─── 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 { MdFab } from '@awc-ui/react';
export function Example() {
return <MdFab></MdFab>;
}
// ─── Option B: single import (tree-shake to only md-fab) ───
// 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-fab';
export function ExampleTreeShaken() {
return <md-fab></md-fab>;
}// ─── 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-fab></md-fab>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-fab'` in main.ts.
import { Component } from '@angular/core';
import { MdFab } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdFab],
template: `<md-fab></md-fab>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdFab } from '@awc-ui/vue';
</script>
<template>
<MdFab></MdFab>
</template>
<!-- ─── Option B: single import (tree-shake to only md-fab) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-fab';
</script>
<template>
<md-fab></md-fab>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-fab></md-fab>
<!-- ─── Option B: single import (tree-shake to only md-fab) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-fab';
</script>
<md-fab></md-fab>md-navigation-rail, where it
collapses to icon-only as the rail collapses.| Situation | Use instead |
|---|---|
| A second prominent action on the same screen | md-button variant="filled" |
| Minor, overflow, unclear or destructive actions | md-button / md-menu |
| An action scoped to a card or other container | A button inside it |
| 2–6 related creation actions behind one trigger | md-fab-menu |
| Screens where imagery already represents the primary action | Nothing — M3 says a FAB isn’t always needed |
primary, secondary, tertiary and their -container forms. The
-container variants are the softer, standard look; the bare roles are
higher-contrast.
surface is M3’s own default FAB — a neutral container with a primary-role
icon, for when the FAB should not compete with the content behind it. This
component defaults to primary-container instead, so pass variant="surface"
explicitly when you want the spec’s baseline.
<!-- 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-fab variant="surface" icon="add" aria-label="Surface"></md-fab>
<md-fab variant="primary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="primary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary" icon="add" aria-label="Add"></md-fab>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdFab variant="surface" icon="add" aria-label="Surface"></MdFab>
<MdFab variant="primary-container" icon="add" aria-label="Add"></MdFab>
<MdFab variant="secondary-container" icon="add" aria-label="Add"></MdFab>
<MdFab variant="tertiary-container" icon="add" aria-label="Add"></MdFab>
<MdFab variant="primary" icon="add" aria-label="Add"></MdFab>
<MdFab variant="secondary" icon="add" aria-label="Add"></MdFab>
<MdFab variant="tertiary" icon="add" aria-label="Add"></MdFab>
</>
);
}// 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-fab variant="surface" icon="add" aria-label="Surface"></md-fab>
<md-fab variant="primary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="primary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary" icon="add" aria-label="Add"></md-fab><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-fab variant="surface" icon="add" aria-label="Surface"></md-fab>
<md-fab variant="primary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="primary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary" icon="add" aria-label="Add"></md-fab>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-fab variant="surface" icon="add" aria-label="Surface"></md-fab>
<md-fab variant="primary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary-container" icon="add" aria-label="Add"></md-fab>
<md-fab variant="primary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="secondary" icon="add" aria-label="Add"></md-fab>
<md-fab variant="tertiary" icon="add" aria-label="Add"></md-fab><!-- 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-fab size="standard" icon="add" aria-label="Add"></md-fab>
<md-fab size="medium" icon="add" aria-label="Add"></md-fab>
<md-fab size="large" icon="add" aria-label="Add"></md-fab>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdFab size="standard" icon="add" aria-label="Add"></MdFab>
<MdFab size="medium" icon="add" aria-label="Add"></MdFab>
<MdFab size="large" icon="add" aria-label="Add"></MdFab>
</>
);
}// 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-fab size="standard" icon="add" aria-label="Add"></md-fab>
<md-fab size="medium" icon="add" aria-label="Add"></md-fab>
<md-fab size="large" icon="add" aria-label="Add"></md-fab><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-fab size="standard" icon="add" aria-label="Add"></md-fab>
<md-fab size="medium" icon="add" aria-label="Add"></md-fab>
<md-fab size="large" icon="add" aria-label="Add"></md-fab>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-fab size="standard" icon="add" aria-label="Add"></md-fab>
<md-fab size="medium" icon="add" aria-label="Add"></md-fab>
<md-fab size="large" icon="add" aria-label="Add"></md-fab>lowered drops the resting elevation for FABs that sit on an already-elevated
surface. disabled and soft-disabled behave as they do on
md-button — the soft one stays focusable.
<!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">default</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab variant="secondary" icon="edit" aria-label="Edit"></md-fab>
<md-fab variant="tertiary" icon="share" aria-label="Share"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">lowered</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab lowered icon="add" aria-label="Create, lowered"></md-fab>
<md-fab lowered variant="secondary" icon="edit" aria-label="Edit, lowered"></md-fab>
<md-fab lowered variant="tertiary" icon="share" aria-label="Share, lowered"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">disabled</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab disabled icon="add" aria-label="Create, disabled"></md-fab>
<md-fab soft-disabled icon="edit" aria-label="Edit, soft-disabled"></md-fab>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '16px', alignItems: 'center' }}>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>default</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab icon="add" aria-label="Create"></MdFab>
<MdFab variant="secondary" icon="edit" aria-label="Edit"></MdFab>
<MdFab variant="tertiary" icon="share" aria-label="Share"></MdFab>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>lowered</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab lowered icon="add" aria-label="Create, lowered"></MdFab>
<MdFab lowered variant="secondary" icon="edit" aria-label="Edit, lowered"></MdFab>
<MdFab lowered variant="tertiary" icon="share" aria-label="Share, lowered"></MdFab>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>disabled</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab disabled icon="add" aria-label="Create, disabled"></MdFab>
<MdFab softDisabled icon="edit" aria-label="Edit, soft-disabled"></MdFab>
</div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">default</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab variant="secondary" icon="edit" aria-label="Edit"></md-fab>
<md-fab variant="tertiary" icon="share" aria-label="Share"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">lowered</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab lowered icon="add" aria-label="Create, lowered"></md-fab>
<md-fab lowered variant="secondary" icon="edit" aria-label="Edit, lowered"></md-fab>
<md-fab lowered variant="tertiary" icon="share" aria-label="Share, lowered"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">disabled</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab disabled icon="add" aria-label="Create, disabled"></md-fab>
<md-fab soft-disabled icon="edit" aria-label="Edit, soft-disabled"></md-fab>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">default</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab variant="secondary" icon="edit" aria-label="Edit"></md-fab>
<md-fab variant="tertiary" icon="share" aria-label="Share"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">lowered</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab lowered icon="add" aria-label="Create, lowered"></md-fab>
<md-fab lowered variant="secondary" icon="edit" aria-label="Edit, lowered"></md-fab>
<md-fab lowered variant="tertiary" icon="share" aria-label="Share, lowered"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">disabled</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab disabled icon="add" aria-label="Create, disabled"></md-fab>
<md-fab soft-disabled icon="edit" aria-label="Edit, soft-disabled"></md-fab>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">default</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab variant="secondary" icon="edit" aria-label="Edit"></md-fab>
<md-fab variant="tertiary" icon="share" aria-label="Share"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">lowered</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab lowered icon="add" aria-label="Create, lowered"></md-fab>
<md-fab lowered variant="secondary" icon="edit" aria-label="Edit, lowered"></md-fab>
<md-fab lowered variant="tertiary" icon="share" aria-label="Share, lowered"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">disabled</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab disabled icon="add" aria-label="Create, disabled"></md-fab>
<md-fab soft-disabled icon="edit" aria-label="Edit, soft-disabled"></md-fab>
</div>
</div><!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">primary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab size="standard" icon="add" aria-label="Create standard"></md-fab>
<md-fab size="medium" icon="add" aria-label="Create medium"></md-fab>
<md-fab size="large" icon="add" aria-label="Create large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">secondary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="secondary" size="standard" icon="edit" aria-label="Edit standard"></md-fab>
<md-fab variant="secondary" size="medium" icon="edit" aria-label="Edit medium"></md-fab>
<md-fab variant="secondary" size="large" icon="edit" aria-label="Edit large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">tertiary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="tertiary" size="standard" icon="share" aria-label="Share standard"></md-fab>
<md-fab variant="tertiary" size="medium" icon="share" aria-label="Share medium"></md-fab>
<md-fab variant="tertiary" size="large" icon="share" aria-label="Share large"></md-fab>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '16px', alignItems: 'center' }}>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>primary</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab size="standard" icon="add" aria-label="Create standard"></MdFab>
<MdFab size="medium" icon="add" aria-label="Create medium"></MdFab>
<MdFab size="large" icon="add" aria-label="Create large"></MdFab>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>secondary</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab variant="secondary" size="standard" icon="edit" aria-label="Edit standard"></MdFab>
<MdFab variant="secondary" size="medium" icon="edit" aria-label="Edit medium"></MdFab>
<MdFab variant="secondary" size="large" icon="edit" aria-label="Edit large"></MdFab>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>tertiary</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab variant="tertiary" size="standard" icon="share" aria-label="Share standard"></MdFab>
<MdFab variant="tertiary" size="medium" icon="share" aria-label="Share medium"></MdFab>
<MdFab variant="tertiary" size="large" icon="share" aria-label="Share large"></MdFab>
</div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">primary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab size="standard" icon="add" aria-label="Create standard"></md-fab>
<md-fab size="medium" icon="add" aria-label="Create medium"></md-fab>
<md-fab size="large" icon="add" aria-label="Create large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">secondary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="secondary" size="standard" icon="edit" aria-label="Edit standard"></md-fab>
<md-fab variant="secondary" size="medium" icon="edit" aria-label="Edit medium"></md-fab>
<md-fab variant="secondary" size="large" icon="edit" aria-label="Edit large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">tertiary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="tertiary" size="standard" icon="share" aria-label="Share standard"></md-fab>
<md-fab variant="tertiary" size="medium" icon="share" aria-label="Share medium"></md-fab>
<md-fab variant="tertiary" size="large" icon="share" aria-label="Share large"></md-fab>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">primary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab size="standard" icon="add" aria-label="Create standard"></md-fab>
<md-fab size="medium" icon="add" aria-label="Create medium"></md-fab>
<md-fab size="large" icon="add" aria-label="Create large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">secondary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="secondary" size="standard" icon="edit" aria-label="Edit standard"></md-fab>
<md-fab variant="secondary" size="medium" icon="edit" aria-label="Edit medium"></md-fab>
<md-fab variant="secondary" size="large" icon="edit" aria-label="Edit large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">tertiary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="tertiary" size="standard" icon="share" aria-label="Share standard"></md-fab>
<md-fab variant="tertiary" size="medium" icon="share" aria-label="Share medium"></md-fab>
<md-fab variant="tertiary" size="large" icon="share" aria-label="Share large"></md-fab>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">primary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab size="standard" icon="add" aria-label="Create standard"></md-fab>
<md-fab size="medium" icon="add" aria-label="Create medium"></md-fab>
<md-fab size="large" icon="add" aria-label="Create large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">secondary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="secondary" size="standard" icon="edit" aria-label="Edit standard"></md-fab>
<md-fab variant="secondary" size="medium" icon="edit" aria-label="Edit medium"></md-fab>
<md-fab variant="secondary" size="large" icon="edit" aria-label="Edit large"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">tertiary</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab variant="tertiary" size="standard" icon="share" aria-label="Share standard"></md-fab>
<md-fab variant="tertiary" size="medium" icon="share" aria-label="Share medium"></md-fab>
<md-fab variant="tertiary" size="large" icon="share" aria-label="Share large"></md-fab>
</div>
</div>Setting a label makes the FAB extended automatically.
<!-- 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-fab icon="edit" label="Compose"></md-fab>
<md-fab label="Start a chat"></md-fab>
<md-fab lowered icon="add" label="Add item"></md-fab>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdFab icon="edit" label="Compose"></MdFab>
<MdFab label="Start a chat"></MdFab>
<MdFab lowered icon="add" label="Add item"></MdFab>
</>
);
}// 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-fab icon="edit" label="Compose"></md-fab>
<md-fab label="Start a chat"></md-fab>
<md-fab lowered icon="add" label="Add item"></md-fab><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab label="Start a chat"></md-fab>
<md-fab lowered icon="add" label="Add item"></md-fab>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-fab icon="edit" label="Compose"></md-fab>
<md-fab label="Start a chat"></md-fab>
<md-fab lowered icon="add" label="Add item"></md-fab><!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">unset + label</span>
<div><md-fab icon="add" label="Compose"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">extended="false"</span>
<div><md-fab icon="add" label="Compose" extended="false"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">no label</span>
<div><md-fab icon="add" aria-label="Compose"></md-fab></div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '14px 16px', alignItems: 'center' }}>
<span style={{ inlineSize: '9rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>unset + label</span>
<div><MdFab icon="add" label="Compose"></MdFab></div>
<span style={{ inlineSize: '9rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>extended="false"</span>
<div><MdFab icon="add" label="Compose" extended="false"></MdFab></div>
<span style={{ inlineSize: '9rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>no label</span>
<div><MdFab icon="add" aria-label="Compose"></MdFab></div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:14px 16px;align-items:center;">
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">unset + label</span>
<div><md-fab icon="add" label="Compose"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">extended="false"</span>
<div><md-fab icon="add" label="Compose" extended="false"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">no label</span>
<div><md-fab icon="add" aria-label="Compose"></md-fab></div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
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:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">unset + label</span>
<div><md-fab icon="add" label="Compose"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">extended="false"</span>
<div><md-fab icon="add" label="Compose" extended="false"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">no label</span>
<div><md-fab icon="add" aria-label="Compose"></md-fab></div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
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:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">unset + label</span>
<div><md-fab icon="add" label="Compose"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">extended="false"</span>
<div><md-fab icon="add" label="Compose" extended="false"></md-fab></div>
<span style="inline-size:9rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">no label</span>
<div><md-fab icon="add" aria-label="Compose"></md-fab></div>
</div>Pinning the value is what makes the FAB morph rather than swap. Press the button below: the label’s width and opacity animate over a spring, because the label stays in the DOM the whole time.
<!-- 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>
<div style="display:flex;gap:16px;align-items:center;">
<md-button id="fab-morph-btn" variant="outlined">Collapse</md-button>
<md-fab id="fab-morph" icon="add" label="Compose"></md-fab>
</div>
<script type="module">
const fab = document.getElementById('fab-morph');
const btn = document.getElementById('fab-morph-btn');
fab.extended = true; // pin it, so the change can animate
btn.addEventListener('mdClick', () => {
fab.extended = !fab.extended;
btn.textContent = fab.extended ? 'Collapse' : 'Extend';
});
</script>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { useEffect, useRef } from 'react';
import { MdButton, MdFab } from '@awc-ui/react';
export function Demo() {
const fabRef = useRef(null);
const btnRef = useRef(null);
useEffect(() => {
const fab = fabRef.current;
const btn = btnRef.current;
fab.extended = true; // pin it, so the change can animate
btn.addEventListener('mdClick', () => {
fab.extended = !fab.extended;
btn.textContent = fab.extended ? 'Collapse' : 'Extend';
});
}, []);
return (
<>
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
<MdButton id="fab-morph-btn" ref={btnRef} variant="outlined">Collapse</MdButton>
<MdFab id="fab-morph" ref={fabRef} icon="add" label="Compose"></MdFab>
</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.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
@ViewChild('fab') fabRef!: ElementRef;
@ViewChild('btn') btnRef!: ElementRef;
ngAfterViewInit() {
const fab = this.fabRef.nativeElement;
const btn = this.btnRef.nativeElement;
fab.extended = true; // pin it, so the change can animate
btn.addEventListener('mdClick', () => {
fab.extended = !fab.extended;
btn.textContent = fab.extended ? 'Collapse' : 'Extend';
});
}
}
<!-- app.component.html -->
<div style="display:flex;gap:16px;align-items:center;">
<md-button id="fab-morph-btn" #btn variant="outlined">Collapse</md-button>
<md-fab id="fab-morph" #fab icon="add" label="Compose"></md-fab>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMounted, ref } from 'vue';
import '@awc-ui/core/define';
const fabRef = ref(null);
const btnRef = ref(null);
onMounted(() => {
const fab = fabRef.value;
const btn = btnRef.value;
fab.extended = true; // pin it, so the change can animate
btn.addEventListener('mdClick', () => {
fab.extended = !fab.extended;
btn.textContent = fab.extended ? 'Collapse' : 'Extend';
});
});
</script>
<template>
<div style="display:flex;gap:16px;align-items:center;">
<md-button id="fab-morph-btn" ref="btnRef" variant="outlined">Collapse</md-button>
<md-fab id="fab-morph" ref="fabRef" icon="add" label="Compose"></md-fab>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMount } from 'svelte';
import '@awc-ui/core/define';
let fabRef;
let btnRef;
onMount(() => {
const fab = fabRef;
const btn = btnRef;
fab.extended = true; // pin it, so the change can animate
btn.addEventListener('mdClick', () => {
fab.extended = !fab.extended;
btn.textContent = fab.extended ? 'Collapse' : 'Extend';
});
});
</script>
<div style="display:flex;gap:16px;align-items:center;">
<md-button id="fab-morph-btn" bind:this={btnRef} variant="outlined">Collapse</md-button>
<md-fab id="fab-morph" bind:this={fabRef} icon="add" label="Compose"></md-fab>
</div>The FAB does not position itself. Placement is yours:
<md-fab icon="add" aria-label="New item" style="position: fixed; inset-block-end: 24px; inset-inline-end: 24px;"></md-fab>Use logical properties (inset-inline-end) so it moves to the correct corner
under dir="rtl".
| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdClick | no | MouseEvent | On activation |
not pressed yet
<!-- 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-fab id="like" icon="favorite" aria-label="Like"></md-fab>
<script type="module">
document.getElementById('like').addEventListener('mdClick', (e) => {
// e.detail IS the original MouseEvent — not a wrapper object
like(e.detail.shiftKey);
});
</script>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { useEffect } from 'react';
import { MdFab } from '@awc-ui/react';
export function Demo() {
useEffect(() => {
document.getElementById('like').addEventListener('mdClick', (e) => {
// e.detail IS the original MouseEvent — not a wrapper object
like(e.detail.shiftKey);
});
}, []);
return (
<>
<MdFab id="like" icon="favorite" aria-label="Like"></MdFab>
</>
);
}// 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.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
ngAfterViewInit() {
document.getElementById('like').addEventListener('mdClick', (e) => {
// e.detail IS the original MouseEvent — not a wrapper object
like(e.detail.shiftKey);
});
}
}
<!-- app.component.html -->
<md-fab id="like" icon="favorite" aria-label="Like"></md-fab><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMounted } from 'vue';
import '@awc-ui/core/define';
onMounted(() => {
document.getElementById('like').addEventListener('mdClick', (e) => {
// e.detail IS the original MouseEvent — not a wrapper object
like(e.detail.shiftKey);
});
});
</script>
<template>
<md-fab id="like" icon="favorite" aria-label="Like"></md-fab>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { onMount } from 'svelte';
import '@awc-ui/core/define';
onMount(() => {
document.getElementById('like').addEventListener('mdClick', (e) => {
// e.detail IS the original MouseEvent — not a wrapper object
like(e.detail.shiftKey);
});
});
</script>
<md-fab id="like" icon="favorite" aria-label="Like"></md-fab><md-fab id="create" icon="add" label="Create"></md-fab>
<script type="module">
document.getElementById('create')
.addEventListener('mdClick', () => openComposer());
</script>import { MdFab } from '@awc-ui/react';
export function CreateFab() {
return <MdFab icon="add" label="Create" onMdClick={() => openComposer()} />;
}import { Component } from '@angular/core';
@Component({
selector: 'app-create-fab',
template: `<md-fab icon="add" label="Create" (mdClick)="openComposer()"></md-fab>`,
})
export class CreateFabComponent {
openComposer() { /* … */ }
}<script setup lang="ts">
function openComposer() { /* … */ }
</script>
<template>
<md-fab icon="add" label="Create" @mdClick="openComposer" />
</template><script lang="ts">
function openComposer() { /* … */ }
</script>
<md-fab icon="add" label="Create" on:mdClick={openComposer} />The rail owns the FAB’s extended state across its collapse transition — slot
it and leave extended alone.
<md-navigation-rail expandable> <md-fab slot="fab" icon="add" label="Create"></md-fab> <md-navigation-rail-tab icon="home" label="Home" value="home"></md-navigation-rail-tab></md-navigation-rail>| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
variant | variant | 'surface' | 'primary-container' | 'secondary-container' | 'tertiary-container' | 'primary' | 'secondary' | 'tertiary' | 'primary-container' | — |
size | size | 'standard' | 'medium' | 'large' | 'standard' | — |
disabled | disabled | boolean | false | Yes |
softDisabled | soft-disabled | boolean | false | Yes |
lowered | lowered | boolean | false | Yes |
ripple | ripple | boolean | true | — |
icon | icon | string | '' | — |
label | label | string | '' | — |
extended | extended | boolean | — | Yes |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
| Slot | Description |
|---|---|
icon | Custom icon (replaces icon prop) |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-fab-container-color | Container background |
--md-fab-icon-color | Icon color |
--md-fab-icon-size | Icon dimensions |
--md-fab-container-shape | Border-radius override |
--md-fab-label-color | Label text color (extended) |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
state-layer | Hover/press overlay |
icon | Icon element |
label | Label text (extended only) |
aria-label. Extended FABs take their name
from label, so an extra aria-label is redundant unless it adds detail.disabled leaves the tab order; soft-disabled stays focusable.An icon has no text, so a FAB is only accessible if something supplies its name. There are exactly three sources, and the component checks for them before its first render:
<!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-label</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create document"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-labelledby</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<span id="fab-name-src" style="opacity:.7;font-size:.85rem;">Create document</span>
<md-fab icon="add" aria-labelledby="fab-name-src"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">label (extended)</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '16px', alignItems: 'center' }}>
<span style={{ inlineSize: '8rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>aria-label</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab icon="add" aria-label="Create document"></MdFab>
</div>
<span style={{ inlineSize: '8rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>aria-labelledby</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<span id="fab-name-src" style={{ opacity: '.7', fontSize: '.85rem' }}>Create document</span>
<MdFab icon="add" aria-labelledby="fab-name-src"></MdFab>
</div>
<span style={{ inlineSize: '8rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>label (extended)</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab extended icon="add" label="Create document"></MdFab>
</div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-label</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create document"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-labelledby</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<span id="fab-name-src" style="opacity:.7;font-size:.85rem;">Create document</span>
<md-fab icon="add" aria-labelledby="fab-name-src"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">label (extended)</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-label</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create document"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-labelledby</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<span id="fab-name-src" style="opacity:.7;font-size:.85rem;">Create document</span>
<md-fab icon="add" aria-labelledby="fab-name-src"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">label (extended)</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-label</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create document"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">aria-labelledby</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<span id="fab-name-src" style="opacity:.7;font-size:.85rem;">Create document</span>
<md-fab icon="add" aria-labelledby="fab-name-src"></md-fab>
</div>
<span style="inline-size:8rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">label (extended)</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
</div>| Source | Use when |
|---|---|
aria-label | Icon-only. The usual case. |
aria-labelledby | Visible text elsewhere already names it — no duplicated string to translate |
label | extended FABs. The visible label is the accessible name |
RTL — position with logical properties so it lands in the correct corner.
add/edit need no mirroring; a directional glyph does. See RTL.
Density — density="-1…-4" tightens the container; keep it ≥48px on touch.
i18n — translate label and aria-label. Translated labels run longer, so
re-check M3’s no-wrap/no-truncate rule per locale.
<!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="إنشاء"></md-fab>
<md-fab extended icon="add" label="إنشاء مستند"></md-fab>
</div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '16px', alignItems: 'center' }}>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>ltr</span>
<div dir="ltr" style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab icon="add" aria-label="Create"></MdFab>
<MdFab extended icon="add" label="Create document"></MdFab>
</div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>rtl</span>
<div dir="rtl" style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab icon="add" aria-label="إنشاء"></MdFab>
<MdFab extended icon="add" label="إنشاء مستند"></MdFab>
</div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="إنشاء"></md-fab>
<md-fab extended icon="add" label="إنشاء مستند"></md-fab>
</div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="إنشاء"></md-fab>
<md-fab extended icon="add" label="إنشاء مستند"></md-fab>
</div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">ltr</span>
<div dir="ltr" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="Create"></md-fab>
<md-fab extended icon="add" label="Create document"></md-fab>
</div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">rtl</span>
<div dir="rtl" style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab icon="add" aria-label="إنشاء"></md-fab>
<md-fab extended icon="add" label="إنشاء مستند"></md-fab>
</div>
</div>On an extended FAB the icon leads the label, so under RTL it moves to the
right edge on its own — the box metrics are logical. A plain icon-only FAB has
nothing to mirror.
<!-- 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>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="0" icon="add" aria-label="Create 0"></md-fab><md-fab density="0" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-1" icon="add" aria-label="Create -1"></md-fab><md-fab density="-1" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-2" icon="add" aria-label="Create -2"></md-fab><md-fab density="-2" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-3" icon="add" aria-label="Create -3"></md-fab><md-fab density="-3" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-4" icon="add" aria-label="Create -4"></md-fab><md-fab density="-4" extended icon="add" label="Create"></md-fab></div>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '16px', alignItems: 'center' }}>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>0</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}><MdFab density="0" icon="add" aria-label="Create 0"></MdFab><MdFab density="0" extended icon="add" label="Create"></MdFab></div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-1</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}><MdFab density="-1" icon="add" aria-label="Create -1"></MdFab><MdFab density="-1" extended icon="add" label="Create"></MdFab></div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-2</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}><MdFab density="-2" icon="add" aria-label="Create -2"></MdFab><MdFab density="-2" extended icon="add" label="Create"></MdFab></div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-3</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}><MdFab density="-3" icon="add" aria-label="Create -3"></MdFab><MdFab density="-3" extended icon="add" label="Create"></MdFab></div>
<span style={{ inlineSize: '4.5rem', opacity: '.65', fontSize: '.75rem', fontFamily: 'ui-monospace,monospace' }}>-4</span>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}><MdFab density="-4" icon="add" aria-label="Create -4"></MdFab><MdFab density="-4" extended icon="add" label="Create"></MdFab></div>
</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 -->
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="0" icon="add" aria-label="Create 0"></md-fab><md-fab density="0" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-1" icon="add" aria-label="Create -1"></md-fab><md-fab density="-1" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-2" icon="add" aria-label="Create -2"></md-fab><md-fab density="-2" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-3" icon="add" aria-label="Create -3"></md-fab><md-fab density="-3" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-4" icon="add" aria-label="Create -4"></md-fab><md-fab density="-4" extended icon="add" label="Create"></md-fab></div>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="0" icon="add" aria-label="Create 0"></md-fab><md-fab density="0" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-1" icon="add" aria-label="Create -1"></md-fab><md-fab density="-1" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-2" icon="add" aria-label="Create -2"></md-fab><md-fab density="-2" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-3" icon="add" aria-label="Create -3"></md-fab><md-fab density="-3" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-4" icon="add" aria-label="Create -4"></md-fab><md-fab density="-4" extended icon="add" label="Create"></md-fab></div>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<div style="display:grid;grid-template-columns:auto 1fr;gap:16px;align-items:center;">
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">0</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="0" icon="add" aria-label="Create 0"></md-fab><md-fab density="0" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-1</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-1" icon="add" aria-label="Create -1"></md-fab><md-fab density="-1" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-2</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-2" icon="add" aria-label="Create -2"></md-fab><md-fab density="-2" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-3</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-3" icon="add" aria-label="Create -3"></md-fab><md-fab density="-3" extended icon="add" label="Create"></md-fab></div>
<span style="inline-size:4.5rem;opacity:.65;font-size:.75rem;font-family:ui-monospace,monospace;">-4</span>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;"><md-fab density="-4" icon="add" aria-label="Create -4"></md-fab><md-fab density="-4" extended icon="add" label="Create"></md-fab></div>
</div>| Custom property | Purpose |
|---|---|
--md-fab-container-color | Container background |
--md-fab-icon-color / --md-fab-icon-size | Glyph |
--md-fab-container-shape | Corner radius |
--md-fab-label-color | Extended-label colour |
CSS parts — state-layer, icon, label. Slot — icon for a custom 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>
<style>
.fab-brand {
--md-fab-container-color: #1B5E20;
--md-fab-icon-color: #FFFFFF;
--md-fab-label-color: #FFFFFF;
}
.fab-square { --md-fab-container-shape: 12px; }
.fab-big-icon::part(icon) { transform: scale(1.3); }
</style>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab class="fab-brand" icon="add" aria-label="Brand colour"></md-fab>
<md-fab class="fab-brand" extended icon="add" label="Brand extended"></md-fab>
<md-fab class="fab-square" icon="edit" aria-label="Square shape"></md-fab>
<md-fab class="fab-big-icon" variant="secondary" icon="share" aria-label="Larger icon via ::part"></md-fab>
</div>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdFab } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.fab-brand {
--md-fab-container-color: #1B5E20;
--md-fab-icon-color: #FFFFFF;
--md-fab-label-color: #FFFFFF;
}
.fab-square { --md-fab-container-shape: 12px; }
.fab-big-icon::part(icon) { transform: scale(1.3); }
</style>
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap', alignItems: 'center' }}>
<MdFab className="fab-brand" icon="add" aria-label="Brand colour"></MdFab>
<MdFab className="fab-brand" extended icon="add" label="Brand extended"></MdFab>
<MdFab className="fab-square" icon="edit" aria-label="Square shape"></MdFab>
<MdFab className="fab-big-icon" variant="secondary" icon="share" aria-label="Larger icon via ::part"></MdFab>
</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 -->
<style>
.fab-brand {
--md-fab-container-color: #1B5E20;
--md-fab-icon-color: #FFFFFF;
--md-fab-label-color: #FFFFFF;
}
.fab-square { --md-fab-container-shape: 12px; }
.fab-big-icon::part(icon) { transform: scale(1.3); }
</style>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab class="fab-brand" icon="add" aria-label="Brand colour"></md-fab>
<md-fab class="fab-brand" extended icon="add" label="Brand extended"></md-fab>
<md-fab class="fab-square" icon="edit" aria-label="Square shape"></md-fab>
<md-fab class="fab-big-icon" variant="secondary" icon="share" aria-label="Larger icon via ::part"></md-fab>
</div><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<style>
.fab-brand {
--md-fab-container-color: #1B5E20;
--md-fab-icon-color: #FFFFFF;
--md-fab-label-color: #FFFFFF;
}
.fab-square { --md-fab-container-shape: 12px; }
.fab-big-icon::part(icon) { transform: scale(1.3); }
</style>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab class="fab-brand" icon="add" aria-label="Brand colour"></md-fab>
<md-fab class="fab-brand" extended icon="add" label="Brand extended"></md-fab>
<md-fab class="fab-square" icon="edit" aria-label="Square shape"></md-fab>
<md-fab class="fab-big-icon" variant="secondary" icon="share" aria-label="Larger icon via ::part"></md-fab>
</div>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<style>
.fab-brand {
--md-fab-container-color: #1B5E20;
--md-fab-icon-color: #FFFFFF;
--md-fab-label-color: #FFFFFF;
}
.fab-square { --md-fab-container-shape: 12px; }
.fab-big-icon::part(icon) { transform: scale(1.3); }
</style>
<div style="display:flex;gap:16px;flex-wrap:wrap;align-items:center;">
<md-fab class="fab-brand" icon="add" aria-label="Brand colour"></md-fab>
<md-fab class="fab-brand" extended icon="add" label="Brand extended"></md-fab>
<md-fab class="fab-square" icon="edit" aria-label="Square shape"></md-fab>
<md-fab class="fab-big-icon" variant="secondary" icon="share" aria-label="Larger icon via ::part"></md-fab>
</div>The three parts — state-layer, icon, label — cover what the custom
properties cannot reach, such as transforming the glyph itself.
md-fab-menu ·
md-button ·
md-icon-button ·
md-navigation-rail ·
md-toolbar
md-fabTwo 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-fab 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.