Skip to content

Transfer List

A dual-list selector. Two columns — source and target — with per-side search, select-all headers, checkbox rows, and four movers between them. The value prop is the set of item values currently in the target column.

Live preview — check rows and move them across Open in Storybook
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list
  id="roles"
  source-title="Available roles"
  target-title="Assigned roles"
  style="--md-transfer-list-height: 340px;"
  ></md-transfer-list>

<script type="module">
  const el = document.getElementById('roles');

  // Arrays are PROPERTIES, never attributes.
  el.items = [
    { value: 'analytics', label: 'Analytics', description: 'Read dashboards' },
    { value: 'billing', label: 'Billing', description: 'Invoices and payment methods' },
    { value: 'owner', label: 'Owner', disabled: true },
  ];
  el.value = ['support'];      // 'support' starts in the TARGET column

  el.addEventListener('mdChange', (e) => saveRoles(e.detail));
</script>

Already installed? See the Installation guide for one-time package setup (core + tokens, fonts). Each tab below shows two patterns for using md-transfer-list 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-transfer-list) ─── -->
<script type="module">
  import '@awc-ui/core/components/md-transfer-list';
</script>


<md-transfer-list></md-transfer-list>
  • Assigning a subset out of a known, bounded pool: users→roles, permissions→groups, columns→a report, tags→an article.
  • The user benefits from seeing chosen and unchosen side by side, and from moving items in batches.
  • Item counts roughly 10–300 per side.
SituationUse instead
Picking a handful from a short list (< ~10)md-multi-select
Picking exactly onemd-select
Free-text entry with suggestionsmd-autocomplete
A flat multi-select where order/side doesn’t mattermd-checkbox group or md-list
Toggling a handful of independent optionsmd-switch / md-checkbox
The two sides mean different things (not the same items relocated)Two separate lists
Narrow mobile viewportsmd-multi-select — three columns don’t fit

value is the target column. Anything in items but not in value renders on the source side. There is no separate “source items” prop — the component derives the source side by subtraction.

items minus value on the left, value on the right
Show code for each technology
<md-transfer-list id="roles"
source-title="Source (items minus value)"
target-title="Target (value)"
></md-transfer-list>

<script type="module">
const el = document.getElementById('roles');
el.items = [
  { value: 'a', label: 'Analytics', description: 'Read dashboards' },
  { value: 'b', label: 'Billing', disabled: true },
  { value: 'c', label: 'Content editor' },
];
el.value = ['b'];             // 'b' starts in the TARGET column
</script>
MoverActs on
›Items checked and currently visible under that side’s search filter
‹Same, in the other direction
»Every non-disabled item on that side — ignores the search filter
«Same, in the other direction

Check state is tracked per side and is cleared for that side after a move. disabled items never move, in single-step or bulk.

single-step-only + show-select-all=false — safety-first, no bulk moves Open in Storybook
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list
  id="columns"
  source-title="Columns"
  target-title="Shown in report"
  single-step-only
  show-select-all="false"
  ></md-transfer-list>

<script type="module">
  var el = document.getElementById('columns');
  el.items = [
    { value: 'name', label: 'Name' },
    { value: 'email', label: 'Email' },
    { value: 'role', label: 'Role' },
    { value: 'created', label: 'Created at' },
    { value: 'last', label: 'Last seen' },
    { value: 'plan', label: 'Plan' },
  ];
  el.value = ['name', 'email'];
</script>

searchable defaults to true. Turn it off for short lists where a search field is noise. density="-1…-4" tightens row padding and is forwarded to both search fields.

Dense + searchable, and a short non-searchable list with a custom empty state Open in Storybook
Show code for each technology
<!-- 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-transfer-list
  id="tags"
  source-title="Tags" target-title="Applied"
  density="-2"
  source-search-placeholder="Search tags"
  target-search-placeholder="Search applied"
  count-template="{checked}/{total} selected"
  ></md-transfer-list>

  <md-transfer-list
    source-title="Short list" target-title="Picked"
    searchable="false"
    empty-icon="inbox" empty-text="Nothing here yet"
    ></md-transfer-list>

<script type="module">
  var el = document.getElementById('tags');
  el.items = [
    { value: 'urgent', label: 'Urgent' },
    { value: 'billing', label: 'Billing' },
    { value: 'bug', label: 'Bug' },
    { value: 'feature', label: 'Feature request' },
  ];
  el.value = ['urgent'];
</script>

count-template interpolates {checked} and {total} — keep both tokens when translating.

EventCancelableDetailFires
mdChangenostring[] — the new target setEvery change to value
mdMoveno{ direction: 'left' | 'right', moved: string[], target: string[] }After a move, describing it

Methods — moveSelectedRight(), moveSelectedLeft().

mdMove and mdChange as rows cross
Move a row to see mdMove and mdChange fire.
Show code for each technology
<md-transfer-list
id="roles"
source-title="Available roles"
target-title="Assigned roles"
density="-1"
></md-transfer-list>

<script type="module">
const el = document.getElementById('roles');

const ROLES = [
  { value: 'analytics', label: 'Analytics', description: 'Read dashboards' },
  { value: 'billing', label: 'Billing', description: 'Invoices and payments' },
  { value: 'support', label: 'Support agent', description: 'Answer tickets' },
  { value: 'devops', label: 'DevOps', description: 'Deploys and infra' },
];

el.items = ROLES;
el.value = ['support'];          // starts in the TARGET column

el.addEventListener('mdChange', (e) => saveRoles(e.detail));
el.addEventListener('mdMove', (e) => {
  const { direction, moved } = e.detail;
  toast(moved.length + ' moved ' + (direction === 'right' ? 'in' : 'out'));
});
</script>

Properties

Property Attribute Type Default Reflects
items items MdTransferListItem[] | string [] —
value JS only string[] [] —
sourceTitle source-title string 'Choices' —
targetTitle target-title string 'Chosen' —
searchable searchable boolean true Yes
sourceSearchPlaceholder source-search-placeholder string 'Search choices' —
targetSearchPlaceholder target-search-placeholder string 'Search chosen' —
showSelectAll show-select-all boolean true Yes
searchIcon search-icon string 'search' —
moveRightIcon move-right-icon string 'chevron_right' —
moveLeftIcon move-left-icon string 'chevron_left' —
moveAllRightIcon move-all-right-icon string 'keyboard_double_arrow_right' —
moveAllLeftIcon move-all-left-icon string 'keyboard_double_arrow_left' —
emptyIcon empty-icon string '' —
emptyText empty-text string 'No items' —
countTemplate count-template string '{checked}/{total} selected' —
density density 0 | -1 | -2 | -3 | -4 0 Yes
disabled disabled boolean false Yes
singleStepOnly single-step-only boolean false Yes
moveRightLabel move-right-label string 'Move selected to target' —
moveLeftLabel move-left-label string 'Move selected to source' —
moveAllRightLabel move-all-right-label string 'Move all to target' —
moveAllLeftLabel move-all-left-label string 'Move all to source' —

Methods

Method Parameters
moveSelectedRight() none
moveSelectedLeft() none

CSS Custom Properties

Override on the host element for per-instance theming:

Property Description
--md-transfer-list-width Explicit inline-size (default: auto; 100% supported)
--md-transfer-list-min-width Minimum inline-size
--md-transfer-list-max-width Maximum inline-size
--md-transfer-list-height Explicit block-size (default: auto; 100% supported —
--md-transfer-list-min-height Minimum block-size
--md-transfer-list-max-height Maximum block-size
--md-transfer-list-column-min-width Min-width of each column
--md-transfer-list-column-max-block Max-height of each column (default 360px,
--md-transfer-list-container-shape Container corner radius
--md-transfer-list-container-color Column background
--md-transfer-list-header-color Header background
--md-transfer-list-header-text-color Header text color
--md-transfer-list-item-inset Row plate inset from the panel edge
--md-transfer-list-item-padding Padding of each row (derived from
--md-transfer-list-item-gap Gap between checkbox and label
--md-transfer-list-divider-color Divider color
--md-transfer-list-controls-gap Gap between controls buttons
--md-transfer-list-empty-icon-size Empty-state icon size (default 32px,
--md-transfer-list-control-size —
--md-transfer-list-control-icon-size —

CSS Shadow Parts

Style internal elements through shadow DOM with ::part():

Part Description
header Header bar
header-title Header title cluster
count "{n}/{total} selected" pill
search Search field per side
empty Empty-state message
empty-icon Optional empty-state glyph (via `empty-icon` prop)
list The <ul> listbox per side
item Each <li> row
controls Centre column with move buttons
  • The host is role="group" with aria-disabled. Each list is a role="listbox" with aria-multiselectable="true", labelled by its column title; rows are role="option" with aria-selected / aria-disabled.
  • Rows are keyboard-operable: Tab to a row, Space or Enter to toggle.
  • The inner md-checkbox per row is inert + aria-hidden — the row itself is the control, which avoids a nested interactive element.
  • Mover buttons take their accessible names from the four move-*-label props. Note these are deliberately not aria-*-prefixed attributes: a custom attribute in the ARIA namespace fails axe’s aria-valid-attr.
  • The empty state is role="status", so filtering down to nothing is announced.
  • When the whole control is disabled, the scroll regions keep tabindex="0" so they stay reachable (axe scrollable-region-focusable).
Disabled — scroll regions stay focusable Open in Storybook
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list id="locked" source-title="Available" target-title="Assigned" disabled></md-transfer-list>

<script type="module">
  var el = document.getElementById('locked');
  el.items = [
    { value: 'analytics', label: 'Analytics' },
    { value: 'billing', label: 'Billing' },
    { value: 'support', label: 'Support agent' },
  ];
  el.value = ['support'];
</script>

RTL — layout is logical-property based, so the source/target columns swap under dir="rtl". The mover glyphs do not auto-mirror: pass mirrored values yourself. See RTL.

dir=rtl — columns swap, mover glyphs passed mirrored
Show code for each technology
<!-- 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 dir="rtl">
  <md-transfer-list
    id="tl-rtl"
    dir="rtl"
    source-title="الأدوار المتاحة"
    target-title="الأدوار المُسندة"
    source-search-placeholder="بحث"
    target-search-placeholder="بحث"
    move-right-icon="chevron_left"
    move-left-icon="chevron_right"
    move-all-right-icon="keyboard_double_arrow_left"
    move-all-left-icon="keyboard_double_arrow_right"
    style="inline-size: 100%; --md-transfer-list-height: 260px; --md-transfer-list-column-min-width: 180px;"
    ></md-transfer-list>
  </div>

<script type="module">
  var el = document.getElementById('tl-rtl');
  el.items = [
    { value: 'analytics', label: 'التحليلات' },
    { value: 'billing', label: 'الفوترة' },
    { value: 'content', label: 'المحتوى' },
    { value: 'support', label: 'الدعم' },
  ];
  el.value = ['support'];
</script>

Density — density="-1…-4" tightens row padding and is forwarded to the two search fields. See Density.

Every rung, 0 through -4 — row padding and both search fields tighten together
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list density="0"  source-title="Roles" target-title="Assigned"></md-transfer-list>
<md-transfer-list density="-1" source-title="Roles" target-title="Assigned"></md-transfer-list>
<md-transfer-list density="-2" source-title="Roles" target-title="Assigned"></md-transfer-list>
<md-transfer-list density="-3" source-title="Roles" target-title="Assigned"></md-transfer-list>
<md-transfer-list density="-4" source-title="Roles" target-title="Assigned"></md-transfer-list>

<script type="module">
  // Plain HTML has nowhere to put an array, so items / value are assigned as
  // properties. Every framework below binds them directly instead.
  for (const tl of document.querySelectorAll('md-transfer-list')) {
    tl.items = roles;
    tl.value = ['support'];
  }
</script>

i18n — every string is a prop: source-title, target-title, both search placeholders, empty-text, count-template, and the four move-*-labels. count-template interpolates {checked} and {total} — keep both tokens. Per the house i18n approach, resolve these from your dictionary in the consumer layer rather than inside the component.

Every visible string resolved from a dictionary — check a row to see count-template
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list
  id="tl-fr"
  source-title="Rôles disponibles" target-title="Rôles attribués"
  source-search-placeholder="Rechercher" target-search-placeholder="Rechercher"
  count-template="{checked}/{total} sélectionnés"
  empty-text="Aucun élément"
  move-right-label="Déplacer la sélection vers la droite"
  move-left-label="Déplacer la sélection vers la gauche"
  move-all-right-label="Tout déplacer vers la droite"
  move-all-left-label="Tout déplacer vers la gauche"
  style="inline-size: 100%; --md-transfer-list-height: 260px;"
  ></md-transfer-list>

<script type="module">
  var el = document.getElementById('tl-fr');
  el.items = [
    { value: 'analytics', label: 'Analytique', description: 'Lire les tableaux de bord' },
    { value: 'billing', label: 'Facturation', description: 'Factures et paiements' },
    { value: 'content', label: 'Éditeur de contenu' },
    { value: 'support', label: 'Agent de support' },
  ];
  el.value = [];
</script>
Custom propertyPurpose
--md-transfer-list-width / -min-width / -max-widthOverall inline-size bounds
--md-transfer-list-height / -min-height / -max-heightOverall block-size bounds
--md-transfer-list-column-min-widthPer-column floor before wrapping
--md-transfer-list-column-max-blockScroll height of each list
--md-transfer-list-container-color / -container-shapeColumn surface and radius
--md-transfer-list-header-color / -header-text-colorHeader tone
--md-transfer-list-divider-colorRule between header and list
--md-transfer-list-item-padding / -item-gap / -item-insetRow metrics
--md-transfer-list-controls-gap / -control-size / -control-icon-sizeMover column metrics
--md-transfer-list-empty-icon-sizeEmpty-state glyph size

Every default resolves through an md-sys-color role, so a transfer list that sets no custom properties follows the theme on its own:

Untouched defaults — follows the page theme Open in Storybook
Show code for each technology
<!-- index.html — register the AWC UI elements once -->
<script type="module">
  import '@awc-ui/core/define';
</script>

<md-transfer-list id="roles" source-title="Choices" target-title="Chosen"></md-transfer-list>

<script type="module">
  var el = document.getElementById('tl-dark');
  el.items = [
    { value: 'analytics', label: 'Analytics' },
    { value: 'billing', label: 'Billing' },
    { value: 'support', label: 'Support agent' },
  ];
  el.value = ['support'];
</script>
PartElement
header / header-title / countA pane’s header, its title, its counter
searchA pane’s filter field
list / itemThe scroll region and each row
actionsThe move-button column between the panes
header, header-title, count, list and actions Open in Storybook
Show code for each technology
<style>
md-transfer-list::part(header) { text-transform: uppercase; letter-spacing: .08em; }
md-transfer-list::part(header-title) { font-weight: 700; color: var(--md-sys-color-primary); }
md-transfer-list::part(count) { font-variant-numeric: tabular-nums; color: var(--md-sys-color-tertiary); }
md-transfer-list::part(list) { border-radius: 12px; outline: 1px solid var(--md-sys-color-outline-variant); }
md-transfer-list::part(actions) { gap: 12px; }
</style>

<md-transfer-list id="roles" source-title="Available" target-title="Assigned"></md-transfer-list>

<script type="module">
const el = document.getElementById('roles');
el.items = [/* … */];
el.value = ['support'];
</script>

md-multi-select · md-select · md-autocomplete · md-checkbox · md-list · md-text-field · md-icon-button

For AI Agents — md-transfer-list

Two 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?".

Per-component

md-transfer-list 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.

Main-LLM spec

AWC UI Operator's Manual

System-prompt preamble · decision matrix · token reference · page recipes · anti-patterns. Paste into the system prompt at the start of a piece of work.

Open spec

md-transfer-list readme.md

# md-transfer-list

<!-- llm:meta
tag: md-transfer-list
category: data
status: custom
m3-guidelines: none — M3 has no transfer-list component
m3-derived-from: https://m3.material.io/components/lists/guidelines
reference-parity: https://mui.com/material-ui/react-transfer-list/
form-associated: false
depends-on: md-checkbox, md-text-field, md-ripple, md-icon-button
used-by: none
-->

**A dual-list selector.** Two columns — *source* and *target* — with per-side
search, select-all headers, checkbox rows, and four movers between them. The
`value` prop is the set of item values currently in the **target** column.

> ⚠️ **Not a Material Design 3 component.** M3 has no transfer-list page. The
> Do/Don't below are derived from M3's
> [Lists](https://m3.material.io/components/lists/guidelines) and
> [Checkbox](https://m3.material.io/components/checkbox/guidelines) guidance
> plus this component's actual behavior — treat them as house rules, not spec.

> ⚠️ **Not form-associated.** It does not participate in `FormData` — read
> `mdChange` and submit the values yourself.

> Setup, theming, density and i18n are configured once for the whole library —
> see [`main-llm.md`](../../../../../main-llm.md), the library-wide specification shipped
> alongside these manuals.

---

## When to use

- Assigning a **subset out of a known, bounded pool**: users→roles,
  permissions→groups, columns→a report, tags→an article.
- The user benefits from seeing **chosen and unchosen side by side**, and from
  moving items in **batches**.
- Item counts roughly **10–300** per side.

## When NOT to use

| Situation | Use instead |
|---|---|
| Picking a handful from a short list (< ~10) | `md-multi-select` |
| Picking exactly one | `md-select` |
| Free-text entry with suggestions | `md-autocomplete` |
| A flat multi-select where order/side doesn't matter | `md-checkbox` group or `md-list` |
| Toggling a handful of independent options | `md-switch` / `md-checkbox` |
| The two sides mean different *things* (not the same items relocated) | Two separate lists |
| Narrow mobile viewports | `md-multi-select` — three columns don't fit |
| A value that must submit with a form | Mirror `mdChange` into hidden inputs yourself |

## Decision cues

| Need | Setting |
|---|---|
| Long lists users must filter | `searchable` (default `true`) |
| Short lists where search is noise | `searchable="false"` |
| Prevent accidental bulk moves | `single-step-only` — drops the `»`/`«` movers |
| No select-all checkbox in headers | `show-select-all="false"` |
| Compact rows in a dense admin UI | `density="-1"`…`"-4"` |
| Items that exist but can't be moved | `disabled: true` on the item object |
| No leading glyph in the search fields | `search-icon=""` |
| Fill the parent box | The `full-width` / `full-height` attributes |

## API contract

```ts
interface MdTransferListItem {
  value: string;        // stable identifier
  label: string;        // visible text
  description?: string; // secondary line
  disabled?: boolean;   // visible but immovable
}
```

```html
<md-transfer-list
  source-title="Choices"
  target-title="Chosen"
  searchable="true"                  <!-- default: true -->
  show-select-all="true"             <!-- default: true -->
  source-search-placeholder="Search choices"
  target-search-placeholder="Search chosen"
  count-template="{checked}/{total} selected"
  empty-text="No items"
  empty-icon=""                      <!-- default: "" (no glyph) -->
  search-icon="search"               <!-- "" for none -->
  single-step-only                   <!-- default: false -->
  disabled
  full-width                         <!-- CSS-only attribute -->
  full-height                        <!-- CSS-only attribute -->
  density="-1|-2|-3|-4"              <!-- omit for the default rung -->
  move-right-icon="chevron_right"
  move-left-icon="chevron_left"
  move-all-right-icon="keyboard_double_arrow_right"
  move-all-left-icon="keyboard_double_arrow_left"
  move-right-label="Move selected to target"
  move-left-label="Move selected to source"
  move-all-right-label="Move all to target"
  move-all-left-label="Move all to source"
></md-transfer-list>
```

`items` takes **either form** — the array as a JS property, or a JSON string as
an attribute. `value` is `string[]` and has **no attribute**: set it as a
property.

```html
<!-- Attribute form: JSON, single-quoted so the inner quotes survive -->
<md-transfer-list
  items='[{"value":"a","label":"Analytics"},{"value":"b","label":"Billing","disabled":true}]'
></md-transfer-list>
```

```js
const el = document.querySelector('md-transfer-list');
el.items = [
  { value: 'a', label: 'Analytics', description: 'Read dashboards' },
  { value: 'b', label: 'Billing', disabled: true },
];
el.value = ['b'];               // 'b' starts in the TARGET column
```

```jsx
// React — no ref, no effect: the wrapper forwards items/value as properties
<MdTransferList items={items} value={assigned}
                onMdChange={(e) => setAssigned(e.detail)} />
```

```html
<!-- Vue -->      <md-transfer-list :items="items" :value="assigned" @mdChange="assigned = $event.detail" />
<!-- Svelte -->   <md-transfer-list {items} {value} on:mdChange={(e) => (value = e.detail)}></md-transfer-list>
<!-- Angular -->  <md-transfer-list [items]="items" [value]="assigned" (mdChange)="assigned = $event.detail"></md-transfer-list>
```

**Events** — both are default Stencil events (`bubbles: true`,
`composed: true`).

| Event | Detail | Fires |
|---|---|---|
| `mdChange` | `string[]` — the new target set | After a move completes |
| `mdMove` | `{ direction: 'left' \| 'right', moved: string[], target: string[] }` | After the same move, describing it |

**Methods** — `moveSelectedRight()` and `moveSelectedLeft()`; both async, both
apply the same visible-and-checked rule as the `›` / `‹` buttons.

**Slots** — none. The component renders no `<slot>`; content comes entirely
from `items`, and every string is a prop.

**Parts** — `column` (plus `column-source` / `column-target` on the same
element), `header`, `header-title`, `count`, `search`, `list`, `item`, `empty`,
`empty-icon`, `controls`.

### Behavioral contract worth knowing

- **`value` = the target column.** Anything in `items` but not in `value` is
  rendered on the source side. There is no separate "source items" prop.
- **The single-step movers (`›` / `‹`) act only on items that are both checked
  and currently visible** under that side's search filter. A checked item hidden
  by the filter is *not* moved. The `moveSelectedRight()` / `moveSelectedLeft()`
  methods follow the same rule.
- **The bulk movers (`»` / `«`) ignore the search filter** and move every
  non-disabled item on that side.
- **Neither kind of move ever touches a `disabled` item.**
- Check state is tracked **per side** and is cleared for that side after a move.
- **A move replaces `value` with a brand-new array** — it is never mutated in
  place — and then emits `mdChange` followed by `mdMove`, both carrying that
  new array. Because the reference changes, React/Vue consumers can store
  `e.detail` directly and do not need to clone it. Assigning `value` yourself
  does **not** emit either event — it just re-partitions the columns.
- **`count-template` counts what is eligible and visible**, not the whole side:
  `{total}` is the number of non-disabled items matching the current search, and
  `{checked}` is how many of those are ticked. Filtering changes both numbers.
- The header select-all checkbox toggles exactly that eligible-and-visible set,
  and shows indeterminate when only some of it is ticked.
- Malformed JSON in the `items` attribute degrades to an empty list with a
  console warning rather than throwing.
- Each row `<li>` is the interactive option — clicking anywhere on it toggles.
  The `md-checkbox` inside is `inert` and `aria-hidden`, so it is not a nested
  interactive control.
- `full-width` and `full-height` are **CSS-only attributes**, not props: they
  exist in the stylesheet and have no TypeScript counterpart.

---

## Do / Don't

House rules — derived from M3 lists/checkbox guidance, not from a spec page.

| ✅ Do | ❌ Don't |
|---|---|
| Label both columns meaningfully (`Available roles` / `Assigned roles`) | Don't ship the defaults `Choices` / `Chosen` in production UI |
| Keep `value` items stable and unique | Don't reuse a `value` across two items — matching is by value |
| Give long lists `searchable` | Don't force users to scroll hundreds of unfiltered rows |
| Use `description` for the disambiguating detail | Don't stuff two facts into `label` — it wraps and breaks row rhythm |
| Localize every `*-label` and `count-template` | Don't leave English mover labels in a translated app — they're the only accessible names those buttons have |
| Use `disabled` items to show *why* something is unavailable | Don't silently filter immovable items out of `items` |
| Persist on `mdChange` | Don't read `.value` synchronously right after a click without awaiting the event |
| Reserve a stable height (`--md-transfer-list-height`) | Don't let the control resize as items move — the movers jump under the cursor |
| Collapse to `md-multi-select` on narrow viewports | Don't render three columns below ~600px |
| Use sentence case in labels and titles | Don't uppercase column titles |

---

## Patterns

```html
<!-- Role assignment, dense admin UI -->
<md-transfer-list
  id="roles"
  source-title="Available roles"
  target-title="Assigned roles"
  density="-1"
  empty-icon="inbox"
  empty-text="Nothing here yet"
  style="--md-transfer-list-height: 420px;"
></md-transfer-list>

<script type="module">
  const el = document.getElementById('roles');

  el.items = [
    { value: 'analytics', label: 'Analytics', description: 'Read dashboards' },
    { value: 'billing', label: 'Billing', description: 'Invoices and payments' },
    { value: 'support', label: 'Support agent', description: 'Answer tickets' },
  ];
  el.value = ['support'];        // starts in the TARGET column

  el.addEventListener('mdChange', (e) => console.log('assigned:', e.detail));
  el.addEventListener('mdMove', (e) => {
    const { direction, moved } = e.detail;
    console.log(`${moved.length} moved ${direction === 'right' ? 'in' : 'out'}`);
  });
</script>
```

```html
<!-- No script: items declared as a JSON attribute -->
<md-transfer-list
  source-title="Available columns"
  target-title="Shown columns"
  items='[
    {"value":"name","label":"Name"},
    {"value":"email","label":"Email"},
    {"value":"id","label":"Internal ID","disabled":true}
  ]'
></md-transfer-list>
```

```html
<!-- Safety-first: no bulk movers, no select-all -->
<md-transfer-list single-step-only show-select-all="false"></md-transfer-list>
```

```html
<!-- Submitting inside a form (the component is NOT form-associated) -->
<form id="perms-form">
  <md-transfer-list id="perms"></md-transfer-list>
  <div id="perm-fields"></div>
  <md-button type="submit">Save</md-button>
</form>

<script type="module">
  const el = document.getElementById('perms');
  const fields = document.getElementById('perm-fields');
  el.items = [
    { value: 'read', label: 'Read' },
    { value: 'write', label: 'Write' },
  ];
  el.addEventListener('mdChange', (e) => {
    fields.replaceChildren(
      ...e.detail.map((v) => {
        const input = document.createElement('input');
        input.type = 'hidden';
        input.name = 'permissions';
        input.value = v;
        return input;
      }),
    );
  });
</script>
```

```html
<!-- Localized for an RTL locale. Translate the labels; leave the icons alone —
     the stylesheet mirrors the mover glyphs under dir="rtl" by itself. -->
<md-transfer-list
  dir="rtl"
  source-title="الأدوار المتاحة" target-title="الأدوار المعينة"
  source-search-placeholder="بحث" target-search-placeholder="بحث"
  count-template="{checked}/{total}"
  empty-text="لا توجد عناصر"
  move-right-label="نقل المحدد إلى المعينة"
  move-left-label="نقل المحدد إلى المتاحة"
  move-all-right-label="نقل الكل إلى المعينة"
  move-all-left-label="نقل الكل إلى المتاحة"
></md-transfer-list>
```

## Anti-patterns

| ❌ Wrong | ✅ Right | Why |
|---|---|---|
| Maintaining separate `sourceItems` / `targetItems` arrays | One `items` pool + `value` for the target side | The component derives the source side by subtraction. |
| `value="a,b"` as an attribute | `el.value = ['a', 'b']` | `value` has no attribute; only `items` accepts a JSON string. |
| Expecting `›` to move a checked-but-filtered-out item | Clear the search, or use `»` | Single-step movers act on *visible* checked items only. |
| Expecting `mdChange` after assigning `value` yourself | Emit your own signal, or move via the methods | The events fire on a move, not on a property write. |
| Reading `{total}` as "everything on that side" | It is the eligible, visible count | Filtering and `disabled` items both change it. |
| Removing an item from `items` to "disable" it | `{ disabled: true }` | Removal hides the reason; disabled shows it. |
| Rebuilding `items` with fresh objects on every render | Keep the array referentially stable | Re-creating it churns re-renders and can drop check state. |
| Using it for a 5-item choice | `md-multi-select` | Three columns for five options is heavy. |
| Swapping `move-right-icon` / `move-left-icon` to pre-mirror for RTL | Keep the defaults | The stylesheet already flips the mover glyphs under `dir="rtl"`; pre-mirroring flips them twice. |
| Leaving default `move-*-label` values in a localized app | Translate them | They are the icon buttons' only accessible names. |
| Writing `aria-move-right-label` | `move-right-label` | A custom `aria-*` attribute is invalid ARIA (`aria-valid-attr`). |
| Styling `.md-transfer-list__item` directly | `::part(item)` | Internals are shadow-encapsulated and unstable. |
| A ref + `useEffect` / `onMounted` just to set `items` | Bind them as props | The wrappers forward array props; the hook is noise. |
| Reading `el.value` straight after a programmatic move | Read `e.detail` in `mdChange` | The update lands with the event. |
| Letting the container height follow content | Set `--md-transfer-list-height` | Otherwise the mover column shifts mid-interaction. |

## Accessibility, RTL, density, i18n

**Accessibility** — the host is `role="group"` with `aria-disabled`. Each list
is a `role="listbox"` with `aria-multiselectable="true"`, labelled by its column
title; rows are `role="option"` with `aria-selected` and `aria-disabled`, and
are keyboard-operable — Tab to a row, Space or Enter to toggle. The inner
`md-checkbox` per row is `inert` + `aria-hidden`, so the row itself is the only
control. The mover buttons take their accessible names from the four
`move-*-label` props; these are deliberately **not** `aria-*`-prefixed
attributes, because a custom attribute in the ARIA namespace fails
`aria-valid-attr`. The empty state is `role="status"`, so filtering down to
nothing is announced. When the whole control is `disabled` the scroll regions
keep `tabindex="0"` so they stay reachable
(axe `scrollable-region-focusable`).

**RTL** — layout is logical-property based, so the source and target columns
swap sides under `dir="rtl"`. The **mover glyphs mirror themselves**: the
stylesheet applies `transform: scaleX(-1)` to the four control buttons in RTL,
so the default `chevron_right` still points *toward the target column*.
**Leave the four `move-*-icon` props at their defaults in RTL** — passing
pre-mirrored names flips them twice and every chevron ends up aimed at the
wrong column. Put `dir="rtl"` on the `<md-transfer-list>` element itself: the
rule matches `:host([dir='rtl'])` in every browser, while the ancestor form
relies on `:host-context()`, which not all engines implement. Below 640px the
columns stack vertically and that same rule becomes `rotate(90deg)` in both
directions, so "move to target" reads downward — the default glyph names are
correct there too. Only the *glyphs* are handled for you; the four
`move-*-label` props still need translating.

**Density** — `density="-1…-4"` locally overrides the inherited `data-density`
rung; only those four rungs exist, and omitting the attribute is the uncompacted
default. `density="0"` does **not** opt a list out of an ancestor's rung — for
that, set `style="--md-sys-density-scale: 0"`. The rung tightens the row
padding, the title/description type and the empty-state glyph, shrinks the mover
buttons from 40px to 24px, and is forwarded to the two search `md-text-field`s.

**i18n** — every string is a prop: `source-title`, `target-title`, both search
placeholders, `empty-text`, `count-template`, and the four `move-*-label`s.
`count-template` interpolates `{checked}` and `{total}` — keep both tokens when
translating. Per the house i18n approach, resolve these from your dictionary in
the consumer layer rather than inside the component.

## Related components

`md-multi-select` · `md-select` · `md-autocomplete` · `md-checkbox` ·
`md-list` · `md-text-field` · `md-icon-button`

## Theming

| Custom property | Purpose | Default |
|---|---|---|
| `--md-transfer-list-width` | Overall inline size | `auto` |
| `--md-transfer-list-min-width` / `--md-transfer-list-max-width` | Inline-size bounds | `auto` / `none` |
| `--md-transfer-list-height` | Overall block size | `auto` |
| `--md-transfer-list-min-height` / `--md-transfer-list-max-height` | Block-size bounds | `auto` / `none` |
| `--md-transfer-list-column-min-width` | Per-column floor | `260px` |
| `--md-transfer-list-column-max-block` | Scroll height of each list | `--md-transfer-list-height`, else `360px` |
| `--md-transfer-list-container-color` | Column surface | `--md-sys-color-surface-container-low` |
| `--md-transfer-list-container-shape` | Column corner radius | `--md-sys-shape-corner-large` (16px) |
| `--md-transfer-list-header-color` | Header background | `--md-sys-color-surface-container` |
| `--md-transfer-list-header-text-color` | Header text | `--md-sys-color-on-surface` |
| `--md-transfer-list-divider-color` | Rule between header and list | `--md-sys-color-outline-variant` |
| `--md-transfer-list-item-inset` | Row plate inset from the panel edge | `6px` |
| `--md-transfer-list-item-padding` | Row padding | Derived from `--md-sys-spacing-inset-sm` / `-inset-lg` minus the inset |
| `--md-transfer-list-item-gap` | Gap between checkbox and label | `--md-sys-spacing-gap-md` (12px) |
| `--md-transfer-list-controls-gap` | Gap between mover buttons | `--md-sys-spacing-gap-md` (12px) |
| `--md-transfer-list-control-size` | Mover button box | 40px, tapering 4px per density rung (24px floor) |
| `--md-transfer-list-control-icon-size` | Mover glyph | 24px, tapering 2px per rung (16px floor) |
| `--md-transfer-list-empty-icon-size` | Empty-state glyph | 32px, tapering 2px per rung (24px floor) |

**CSS parts** — see the **Parts** list in the API contract; the full generated
list is in **Shadow Parts** below.

```css
md-transfer-list.tall {
  --md-transfer-list-height: 480px;
  --md-transfer-list-column-min-width: 320px;
  --md-transfer-list-container-color: var(--md-sys-color-surface-container);
}
```

<!-- Auto Generated Below -->


## Overview

`md-transfer-list` — Material Design 3 dual-list selector.

Reference parity: https://mui.com/material-ui/react-transfer-list/.

Two columns ("source" and "target") with header chips that show the
"{n} / {total} selected" count, a search field per side, paired
`md-checkbox` rows, and four `md-icon-button` movers in the centre
column. Selection inside each side is independent of which side a
card lives in; the move buttons only act on items that are both
selected AND visible (i.e. matching the search filter).

MD3 Expressive: containers are `surface-container-low`, the headers
use the `secondary-container` tone for emphasis when the title slot
is populated, and movements run on the `motion-emphasized` curve.

## Properties

| Property                  | Attribute                   | Description                                                                                                                                                                            | Type                        | Default                         |
| ------------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------------------------------- |
| `countTemplate`           | `count-template`            | Template for the header count pill (localisable). `{checked}` and `{total}` are replaced with the live numbers.                                                                        | `string`                    | `'{checked}/{total} selected'`  |
| `density`                 | `density`                   | Density scale: 0 (default), -1, -2, -3, -4. Passed to the search text field.                                                                                                           | `-1 \| -2 \| -3 \| -4 \| 0` | `0`                             |
| `disabled`                | `disabled`                  | Disable the entire control.                                                                                                                                                            | `boolean`                   | `false`                         |
| `emptyIcon`               | `empty-icon`                | Optional Material Symbols glyph shown above the empty-state text.                                                                                                                      | `string`                    | `''`                            |
| `emptyText`               | `empty-text`                | Empty-state text (localisable).                                                                                                                                                        | `string`                    | `'No items'`                    |
| `items`                   | --                          | All available items.                                                                                                                                                                   | `MdTransferListItem[]`      | `[]`                            |
| `moveAllLeftIcon`         | `move-all-left-icon`        | Material Symbols glyph for the "move all to source" (<<) button.                                                                                                                       | `string`                    | `'keyboard_double_arrow_left'`  |
| `moveAllLeftLabel`        | `move-all-left-label`       | Accessible label for the << button (localisable).                                                                                                                                      | `string`                    | `'Move all to source'`          |
| `moveAllRightIcon`        | `move-all-right-icon`       | Material Symbols glyph for the "move all to target" (>>) button.                                                                                                                       | `string`                    | `'keyboard_double_arrow_right'` |
| `moveAllRightLabel`       | `move-all-right-label`      | Accessible label for the >> button (localisable).                                                                                                                                      | `string`                    | `'Move all to target'`          |
| `moveLeftIcon`            | `move-left-icon`            | Material Symbols glyph for the "move selected to source" (<) button.                                                                                                                   | `string`                    | `'chevron_left'`                |
| `moveLeftLabel`           | `move-left-label`           | Accessible label for the < button (localisable).                                                                                                                                       | `string`                    | `'Move selected to source'`     |
| `moveRightIcon`           | `move-right-icon`           | Material Symbols glyph for the "move selected to target" (>) button.                                                                                                                   | `string`                    | `'chevron_right'`               |
| `moveRightLabel`          | `move-right-label`          | Accessible label for the > button (localisable). NB: deliberately NOT an `aria-*`-prefixed attribute — a custom attribute in the aria namespace is invalid ARIA (axe aria-valid-attr). | `string`                    | `'Move selected to target'`     |
| `searchIcon`              | `search-icon`               | Material Symbols glyph for the search fields' leading icon ('' = none).                                                                                                                | `string`                    | `'search'`                      |
| `searchable`              | `searchable`                | Render search inputs above each list.                                                                                                                                                  | `boolean`                   | `true`                          |
| `showSelectAll`           | `show-select-all`           | Show the "select all" select-all checkbox in each header.                                                                                                                                  | `boolean`                   | `true`                          |
| `singleStepOnly`          | `single-step-only`          | Show only the >/< buttons (drop >>/<< "move all").                                                                                                                                     | `boolean`                   | `false`                         |
| `sourceSearchPlaceholder` | `source-search-placeholder` | Source-side search placeholder.                                                                                                                                                        | `string`                    | `'Search choices'`              |
| `sourceTitle`             | `source-title`              | Title for the source side.                                                                                                                                                             | `string`                    | `'Choices'`                     |
| `targetSearchPlaceholder` | `target-search-placeholder` | Target-side search placeholder.                                                                                                                                                        | `string`                    | `'Search chosen'`               |
| `targetTitle`             | `target-title`              | Title for the target side.                                                                                                                                                             | `string`                    | `'Chosen'`                      |
| `value`                   | --                          | Values currently in the *target* (right) column.                                                                                                                                       | `string[]`                  | `[]`                            |


## Events

| Event      | Description                                                  | Type                                                                                |
| ---------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| `mdChange` | Fires on every change to the target value.                   | `CustomEvent<string[]>`                                                             |
| `mdMove`   | Fires after items are moved. detail describes the operation. | `CustomEvent<{ direction: "left" \| "right"; moved: string[]; target: string[]; }>` |


## Methods

### `moveSelectedLeft() => Promise<void>`

Move selected items to the source side.

#### Returns

Type: `Promise<void>`



### `moveSelectedRight() => Promise<void>`

Move selected items to the target side.

#### Returns

Type: `Promise<void>`




## Shadow Parts

| Part             | Description |
| ---------------- | ----------- |
| `"controls"`     |             |
| `"count"`        |             |
| `"empty"`        |             |
| `"empty-icon"`   |             |
| `"header"`       |             |
| `"header-title"` |             |
| `"item"`         |             |
| `"list"`         |             |
| `"search"`       |             |


## Dependencies

### Depends on

- [md-checkbox](../md-checkbox)
- [md-text-field](../md-text-field)
- [md-ripple](../md-ripple)
- [md-icon-button](../md-icon-button)

### Graph
```mermaid
graph TD;
  md-transfer-list --> md-checkbox
  md-transfer-list --> md-text-field
  md-transfer-list --> md-ripple
  md-transfer-list --> md-icon-button
  md-checkbox --> md-ripple
  md-icon-button --> md-ripple
  style md-transfer-list fill:#f9f,stroke:#333,stroke-width:4px
```

----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*

AWC UI Operator’s Manual

# main-llm.md — AWC UI build director

<!-- llm:meta
role: director
audience: llm
library: "@awc-ui/core"
component-count: 56
sub-component-count: 25
manual-count: 81
per-component-docs: ./packages/core/src/components/<tag>/readme.md
-->

**Use this reference when building, updating, or reviewing an interface with
AWC UI, a Material Design 3 web-component library.** Start with the user's
request and the existing project. The sections below cover setup, component
selection, composition, and verification; read the sections relevant to the
task. Per-component detail lives in
`./packages/core/src/components/<tag>/readme.md` — e.g.
[`md-button`](./packages/core/src/components/md-button/readme.md).

1. **Match the task's scope** (§1). Reuse decisions from the project and
   conversation. A focused edit does not need a product interview or scaffold.
2. **Choose documented components** using the decision matrix (§5), and read
   each affected component's manual before changing its markup (§6). Check its
   API, `When NOT to use`, accessibility, and `Anti-patterns` sections; do not
   infer behavior from a similar library or sibling component.
3. **Use the existing integration.** For a new app or a requested setup change,
   use §2–§4. For composition, consult §7 and the relevant recipes in §8.
4. **Follow the API and accessibility rules** (§9). Do not invent an `md-*`
   tag, prop, event, slot, CSS part, or token. If the documented API cannot
   satisfy the request, explain the gap and resolve the consequential choice.
5. **Verify the affected behavior** using the applicable checks in §10.
   Report what changed and what was checked. A review reports findings without
   changing files unless a fix was requested.

---

## §1 — Match the task

| Task | How to proceed |
|---|---|
| New app | Establish the app's purpose and use known project or user decisions. Ask only about missing choices that materially affect the result; use reasonable defaults for minor details and state consequential assumptions. Then apply the relevant setup in §2–§4. |
| Existing app or focused fix | Preserve the framework, configuration, design, and product scope unless the request changes them. Inspect the affected code and manuals, then make the requested change. Do not restart discovery or scaffold another app. |
| Review or explanation | Inspect and explain the requested surface. Keep the work read-only unless the user asks for a fix. |

### Optional discovery checklist

Use the questions below as a reference when a new app or requested feature
leaves an important decision open. They are not a required interview, an
ordered sequence, or a reason to stop a focused task. Project configuration
and answers already given in the conversation take precedence; do not ask for
them again. Ask only what matters to the current task, and group related
questions when that helps. The **bold** options are starting defaults for a
new app, not instructions to override an existing project.

### 1.1 Scope and shape

1. **What is the app?** One or two sentences — domain, primary job, who uses it.
2. **What kind of surface is it?**
   - Internal tool / admin console / dashboard
   - Data-heavy CRUD application
   - Consumer-facing product
   - Marketing or content site
   - Mobile-first / PWA
3. **Which framework?** React · Angular · Vue · Svelte · **plain HTML** ·
   Next · Nuxt · SvelteKit · Astro
4. **Does it server-render?** (SSR/SSG, or **client-only SPA**)
5. **Roughly how many distinct screens**, and what are the top 3?

### 1.2 Look and feel

6. **Density** — how much information per screen?
   - `0` — **default**, comfortable, touch-friendly
   - `-1` / `-2` — compact; typical for admin consoles
   - `-3` / `-4` — ultra-compact; dense data tables, trading/ops screens
7. **Theme** — light only, dark only, or **both with a user toggle**?
   Does it follow the OS preference?
8. **Brand color** — a seed/primary color, or **stock MD3 palette**?
9. **Expressive motion** — keep **ripple and shape-morph on** (default), or turn
   them off for a flatter, more utilitarian feel?
10. **Shape language** — **rounded** (MD3 default) or squared?

### 1.3 Internationalization

11. **How many locales**, and which?
12. **Any RTL locales** (Arabic, Hebrew, Farsi, Urdu)? — this changes layout
    verification and directional-icon handling.
13. **Which i18n engine?** (i18next, vue-i18n, ngx-translate, Paraglide, custom)
    Components are engine-agnostic — you localize in the consumer layer.
14. **Locale-formatted values** — dates, numbers, currency? Which locale drives
    `Intl`?

### 1.4 Data and forms

15. **Is there significant tabular data?** How many rows, and is it
    server-paged? (Drives how you page `md-table` — it holds the state, you
    supply each page of rows.)
16. **Are there charts?** Which questions should they answer?
17. **How heavy are the forms?** Validation rules, async validation, multi-step?
18. **Rich text editing anywhere?** — ⚠️ **AWC UI has no RTE component.** If yes,
    the feature needs a third-party editor (TipTap, Lexical, Quill) styled with
    MD3 tokens. Resolve that choice if the project or request does not cover it.

### 1.5 Constraints

19. **Accessibility target** — **WCAG 2.1 AA** (what the library is tested to),
    or stricter?
20. **Browser/device support floor?**
21. **Anything already decided** you must not change — existing design system,
    router, state library, CSS approach?

---

## §2 — Map answers to configuration

Apply this reference to new setup or requested configuration changes. Preserve
an existing project's choices for unrelated work.

| Answer | What you set |
|---|---|
| Admin console / data-heavy | `data-density="-1"` or `-2` on `<html>`; prefer `size="xs"`/`"sm"` on actions |
| Consumer / marketing | leave density alone (`0` is the default); larger button sizes (`md`/`lg`) for CTAs |
| Mobile-first | `md-navigation-bar` + `md-fab`; avoid `md-navigation-rail`, `md-transfer-list`, wide tables |
| Desktop-first | `md-navigation-rail` or `md-app-bar`; rail over bottom bar |
| Dark mode | `data-theme="dark"` on `<html>`; wire a toggle, and mirror OS via `prefers-color-scheme` |
| Both themes with toggle | persist the choice; set the attribute before first paint to avoid a flash |
| Brand color | override the `--md-sys-color-*` roles in your own stylesheet, loaded after the tokens (§4.2) |
| Flat / utilitarian | `data-ripple="off"` and `data-shape-morph="off"` on `<html>` |
| Any RTL locale | `dir="rtl"` on `<html>`; add `mirror-icon` to `md-button`s with directional glyphs; swap the glyph name yourself everywhere else (§4.5) |
| Multiple locales | build a dictionary in the consumer layer and feed component text props from it; never hardcode strings in markup |
| `Intl`-formatted values | pass a `locale` prop where a component exposes one; format everything else before it reaches the component |
| SSR | import from `@awc-ui/core/hydrate` on the server; use the client/server wrappers in `@awc-ui/react` |
| Heavy forms | components are form-associated via `ElementInternals` — use a real `<form>`, `md-button type="submit"`, and native `required` (§4.7) |
| Rich text | integrate a third-party editor; there is no `md-rich-text` |

### 2.1 Global switches — the complete set

All are attributes on `<html>` (or any ancestor; the nearest one wins).

```html
<html
  lang="en"
  dir="ltr"                  <!-- or rtl -->
  data-theme="dark"          <!-- omit for light -->
  data-density="-1"          <!-- -1 … -4; see below -->
  data-ripple="off"          <!-- default on -->
  data-shape-morph="off"     <!-- default on -->
>
```

**`data-density="0"` is inert.** No `[density="0"]` rule exists — density `0` is
simply the base values on `:root`, and a `0` rule would pin them onto every
element (reflected props write `density="0"` almost everywhere) and break global
inheritance. So the *overriding* range is `-1 … -4`. To escape an inherited rung
for one subtree, reset the scale directly:

```css
.opt-out-of-density { --md-sys-density-scale: 0; }
```

Per-component overrides beat the global one: a `density` prop, or
`ripple="off"` / `shape-morph="off"` on the element. **53 of the 57 top-level
components expose a `density` prop.** The four that don't: `md-divider`,
`md-ripple`, `md-sparkline`, `md-tabs`. (Nine sub-components also lack one —
they inherit density from the parent that owns their layout.)

---

## §3 — Install and bootstrap

```bash
npm install @awc-ui/core
```

**Register everything (recommended).** Two imports, once per app entry — one
defines every component, one loads the tokens. Both come from `@awc-ui/core`
itself, so this path needs no second package:

```ts
import { defineCustomElements } from '@awc-ui/core/loader';
import '@awc-ui/core/css/tokens.css';

defineCustomElements(window);
```

`@awc-ui/core/css/tokens.css` is the complete, self-contained token sheet —
light and dark colour roles, shape, elevation, motion, typescale, spacing and
z-index. It is the same set documented in §4.1.

**One-line alternative.** `@awc-ui/core/define` does both steps in a single
import. It loads the package's own token sheet, so it needs nothing else
installed:

```ts
import '@awc-ui/core/define'; // defines every component + loads the token sheet
```

`define` is client-only (it eval-guards `window`) and, because it imports CSS,
it needs a bundler. Never import it into a server graph.

**Per-component registration**, for size-sensitive bundles — load the token
sheet once yourself:

```ts
import '@awc-ui/core/css/tokens.css';
import '@awc-ui/core/components/md-button';
import '@awc-ui/core/components/md-text-field';
```

**Framework wrappers** — use these instead of raw elements; they handle
registration, typed props, and event binding. Below the version floor, drop to
the raw custom elements and the `loader` import above.

| Framework | Package | Requires |
|---|---|---|
| React / Next | `@awc-ui/react` | React 18+ |
| Angular | `@awc-ui/angular` (`AwcUiModule`) | Angular 20.3.31+ |
| Vue / Nuxt | `@awc-ui/vue` | Vue 3 |
| Svelte / SvelteKit | `@awc-ui/svelte` | Svelte 5.57+ |
| Plain HTML / Astro | `@awc-ui/core/loader` | — |

**SSR** — `@awc-ui/core/hydrate` renders Declarative Shadow DOM on the server.
`@awc-ui/react` ships matching client/server wrappers. Keep `define` and
`loader` out of the server graph; both are browser entries.

**Fonts** — components expect Roboto and Material Symbols Outlined to be
available. The library does **not** inject them. Every `icon="…"` prop renders a
Material Symbols glyph inside shadow DOM, so the font must be registered at the
**document** level (font registration crosses shadow boundaries; class rules do
not — the components declare the class rule inside their own roots):

```html
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap">
```

To swap the whole library to a different Material Symbols cut, set
`--md-sys-icon-font-family` on `:root` and load the matching `@font-face`.

---

## §4 — Global configuration reference

### 4.1 The token system

All AWC UI styling resolves to design tokens. **Never hardcode hex colours,
pixel radii, shadows, or font stacks** — they break theming, dark mode, density
and RTL in one stroke. Every value below is a real custom property defined by
`@awc-ui/tokens`; you may read them, and you may override them.

#### Color roles

Light is the default; `[data-theme="dark"]` swaps the palette. Every role has a
matching `on-` role for content drawn on top of it.

| Token | Light | Dark | Typical usage |
|---|---|---|---|
| `--md-sys-color-primary` | `#6750A4` | `#D0BCFF` | Filled buttons, active states |
| `--md-sys-color-on-primary` | `#FFFFFF` | `#381E72` | Text/icons on primary |
| `--md-sys-color-primary-container` | `#EADDFF` | `#4F378B` | FAB, selected segments |
| `--md-sys-color-on-primary-container` | `#21005D` | `#EADDFF` | Text on primary-container |
| `--md-sys-color-secondary` | `#625B71` | `#CCC2DC` | Secondary accents |
| `--md-sys-color-secondary-container` | `#E8DEF8` | `#4A4458` | Tonal buttons, chips |
| `--md-sys-color-tertiary` | `#7D5260` | `#EFB8C8` | Tertiary accents |
| `--md-sys-color-tertiary-container` | `#FFD8E4` | `#633B48` | Tertiary surfaces |
| `--md-sys-color-error` | `#B3261E` | `#F2B8B5` | Error / destructive |
| `--md-sys-color-on-error` | `#FFFFFF` | `#601410` | Content on error |
| `--md-sys-color-error-container` | `#F9DEDC` | `#8C1D18` | Error surfaces |
| `--md-sys-color-surface` | `#FFFBFE` | `#1C1B1F` | Page / card background |
| `--md-sys-color-on-surface` | `#1C1B1F` | `#E6E1E5` | Body text |
| `--md-sys-color-surface-variant` | `#E7E0EC` | `#49454F` | Muted fills |
| `--md-sys-color-on-surface-variant` | `#49454F` | `#CAC4D0` | Secondary text, icons |
| `--md-sys-color-surface-container-lowest` | `#FFFFFF` | `#0F0D13` | Lowest surface tier |
| `--md-sys-color-surface-container-low` | `#F7F2FA` | `#1D1B20` | Card / elevated button bg |
| `--md-sys-color-surface-container` | `#F3EDF7` | `#211F26` | Default container tier |
| `--md-sys-color-surface-container-high` | `#ECE6F0` | `#2B2930` | Dialog / menu surfaces |
| `--md-sys-color-surface-container-highest` | `#E6E0E9` | `#36343B` | Highest surface tier |
| `--md-sys-color-outline` | `#79747E` | `#938F99` | Borders (3:1 contrast) |
| `--md-sys-color-outline-variant` | `#CAC4D0` | `#49454F` | Dividers (low contrast) |
| `--md-sys-color-inverse-surface` | `#313033` | `#E6E1E5` | Snackbar, inverse chips |
| `--md-sys-color-inverse-on-surface` | `#F4EFF4` | `#313033` | Content on inverse-surface |
| `--md-sys-color-scrim` | `#000000` | `#000000` | Modal scrims |

**Semantic status roles** — beyond the baseline M3 palette, the library adds
`success`, `warning` and `info`, each with `on-`, `-container` and
`on-…-container` companions, in both themes, AA-verified. Used by `md-chip`,
`md-badge`, `md-meter`, `md-status-dot`.

| Token | Light | Dark |
|---|---|---|
| `--md-sys-color-success` | `#2E6B4F` | `#9DD5B0` |
| `--md-sys-color-success-container` | `#B8F0CE` | `#14512F` |
| `--md-sys-color-warning` | `#7A5900` | `#EFC148` |
| `--md-sys-color-warning-container` | `#FFDF9B` | `#5C4200` |
| `--md-sys-color-info` | `#38608F` | `#A2C9FE` |
| `--md-sys-color-info-container` | `#D3E4FF` | `#1E4975` |

#### Shape tokens

| Token | Value | Typical usage |
|---|---|---|
| `--md-sys-shape-corner-none` | `0px` | Square edges |
| `--md-sys-shape-corner-extra-small` | `4px` | Snackbar, small chips |
| `--md-sys-shape-corner-small` | `8px` | Cards (outlined), small surfaces |
| `--md-sys-shape-corner-medium` | `12px` | Cards (default), inputs |
| `--md-sys-shape-corner-large` | `16px` | Dialogs, large cards |
| `--md-sys-shape-corner-extra-large` | `28px` | Bottom sheets |
| `--md-sys-shape-corner-full` | `9999px` | Buttons, chips, FAB |

Partial-corner variants also exist for surfaces that meet an edge:
`--md-sys-shape-corner-extra-small-top`, `-large-top`, `-large-end`,
`-extra-large-top`. Their values are four-value `border-radius` shorthands
(e.g. `16px 16px 0px 0px`), so assign them to `border-radius`, not to a single
corner.

#### Elevation tokens

`-0` is the keyword `none`; `-1` through `-5` are complete `box-shadow` values,
and those five are **re-declared with deeper shadows under `[data-theme="dark"]`**
— so always use the token rather than copying its value.

| Token | When |
|---|---|
| `--md-sys-elevation-0` | `none` — resting cards, flat surfaces |
| `--md-sys-elevation-1` | Elevated buttons and cards at rest |
| `--md-sys-elevation-2` | Hover bump |
| `--md-sys-elevation-3` | FAB, menus, dialogs at rest |
| `--md-sys-elevation-4` – `-5` | Reserved for the most prominent surfaces |

#### Motion tokens

Durations come in four families of four: `short1…4` (50/100/150/200ms),
`medium1…4` (250/300/350/400ms), `long1…4` (450/500/550/600ms), and
`extra-long1…4` (700/800/900/1000ms).

| Token | Value | When |
|---|---|---|
| `--md-sys-motion-duration-short2` | `100ms` | Buttons, ripples, state layers |
| `--md-sys-motion-duration-medium2` | `300ms` | Dialogs, sheets, menus |
| `--md-sys-motion-duration-long2` | `500ms` | Large surface transitions |
| `--md-sys-motion-duration-extra-long1` | `700ms` | Ambient / chart entrances |
| `--md-sys-motion-easing-standard` | `cubic-bezier(0.2, 0, 0, 1)` | Small utility transitions |
| `--md-sys-motion-easing-standard-accelerate` | `cubic-bezier(0.3, 0, 1, 1)` | Exits |
| `--md-sys-motion-easing-standard-decelerate` | `cubic-bezier(0, 0, 0, 1)` | Entrances |
| `--md-sys-motion-easing-emphasized` | `cubic-bezier(0.2, 0, 0, 1)` | Expressive transitions |
| `--md-sys-motion-easing-emphasized-accelerate` | `cubic-bezier(0.3, 0, 0.8, 0.15)` | Expressive exits |
| `--md-sys-motion-easing-emphasized-decelerate` | `cubic-bezier(0.05, 0.7, 0.1, 1)` | Expressive entrances |
| `--md-sys-motion-easing-linear` | `linear` | Progress, indeterminate loops |

> `--md-sys-motion-easing-emphasized` deliberately equals the standard curve:
> the full M3 emphasized curve is a two-phase path interpolator that CSS cannot
> express. The accelerate and decelerate halves *are* expressible, and are the
> ones to reach for.

MD3 Expressive also ships spring pairs, each an easing plus its natural
duration: `--md-sys-motion-spring-{spatial,effects}-{fast,default,slow}-easing`
and `…-duration`. Spatial = position/size/shape; effects = colour/opacity.

#### State-layer opacities

| Token | Value |
|---|---|
| `--md-sys-state-hover-state-layer-opacity` | `0.08` |
| `--md-sys-state-focus-state-layer-opacity` | `0.12` |
| `--md-sys-state-pressed-state-layer-opacity` | `0.12` |
| `--md-sys-state-dragged-state-layer-opacity` | `0.16` |
| `--md-sys-state-disabled-container-opacity` | `0.12` |
| `--md-sys-state-disabled-content-opacity` | `0.38` |

#### Typography, spacing and layering

- **Typescale** — `--md-sys-typescale-<role>-<size>-*` for
  `display`/`headline`/`title`/`label`/`body` × `large`/`medium`/`small`. Each
  role exposes `-font-family`, `-font-size`, `-line-height`, `-font-weight`,
  `-letter-spacing`, plus a `-font` shorthand
  (e.g. `--md-sys-typescale-headline-medium-font: 400 28px/36px Roboto, sans-serif`).
  Use the shorthand on the `font` property for headings you write yourself.
- **Spacing** — a 4px scale that tightens with density:
  `--md-sys-spacing-inset-{xs,sm,md,lg,xl}` (internal padding, 4/8/12/16/24px)
  and `--md-sys-spacing-gap-{xs,sm,md,lg}` (between siblings, 4/8/12/16px), plus
  `--md-sys-spacing-row-height` (`56px` at density 0).
- **Layering** — `--md-sys-z-index-app-bar` (100), `-navigation` (200),
  `-bottom-sheet` (300), `-popup` (1000), `-dialog-scrim` (1001), `-tooltip`
  (1500), `-snackbar` (2000). Use these instead of inventing z-indexes, or your
  overlay will land under a menu.

### 4.2 Theming and rebranding

To rebrand, redefine the role variables **after** the tokens stylesheet — both
themes, or dark mode inherits your light brand colour:

```css
:root {
  --md-sys-color-primary: #00629E;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #CFE5FF;
  --md-sys-color-on-primary-container: #001D33;
}
[data-theme="dark"] {
  --md-sys-color-primary: #9BCBFF;
  --md-sys-color-on-primary: #003354;
  --md-sys-color-primary-container: #004A78;
  --md-sys-color-on-primary-container: #CFE5FF;
}
```

Per-component knobs are `--md-<component>-*` custom properties, listed in each
manual's Theming section (`--md-button-container-color`,
`--md-card-container-shape`, …). Prefer those over `::part()`, and prefer
`::part()` over reaching into shadow internals, which are unstable and will
break on any release.

**Overriding a colour role forfeits the library's contrast testing.** Re-verify
AA (4.5:1 text, 3:1 borders and dividers) after any palette change. The Theme
Generator at <https://awc-ui.dev/theme-generator> takes a seed colour, emits both
palettes as `--md-sys-color-*` overrides, and runs the WCAG checks live — use it
rather than hand-picking container and `on-` pairs.

### 4.3 Density

`data-density` steps `-1 → -4`; each rung trims ~4px of padding and touch
target, driving `--md-sys-density-scale` and the spacing tokens. `-4` is the
floor. Set it globally, override locally with the `density` prop. Do not go
below `-2` on touch-primary surfaces — you will break the 48px target.

Two details that bite:

- **`density="0"` does nothing** — see §2 for why, and for the
  `--md-sys-density-scale: 0` escape hatch.
- **`md-table` accepts two vocabularies**: the semantic `compact` / `standard` /
  `comfortable` (row heights 36 / 52 / 60px) *and* the numeric rungs. They
  compose — `density="compact"` inside a `data-density="-2"` region condenses
  further.

### 4.4 Dark mode

Set `data-theme="dark"` on `<html>` (or any ancestor — the nearest wins). The
tokens swap automatically and inherit across every shadow boundary; no
per-component code. To mirror the OS, read `prefers-color-scheme` and write the
attribute **before first paint**, or the page flashes light.

### 4.5 RTL

Layout is written with CSS logical properties, so it flips with `dir="rtl"`
without extra work. Two things still need you:

- **Directional glyphs do not flip.** Material Symbols are not auto-mirrored.
  `md-button` has a `mirror-icon` prop that mirrors its own leading/trailing
  glyph — set it on buttons using arrows, chevrons, `send`, `reply`, and leave
  it off for `add`, `search`, `favorite`. **`mirror-icon` exists only on
  `md-button`.** Everywhere else — `md-icon-button icon="…"`, `md-list-item`
  leading/trailing icons, `md-app-bar leading-icon` — swap the glyph name
  yourself (`arrow_back` ↔ `arrow_forward`).
- **Icon props you supply yourself** — e.g. `md-transfer-list`'s
  `move-right-icon` / `move-left-icon` / `move-all-*-icon` — must be swapped by
  you when the direction flips.

Never write physical CSS (`margin-left`, `padding-right`, `left`) around these
components. Use `margin-inline-start`, `padding-inline-end`, `inset-inline-end`.

### 4.6 Internationalization

Components are **i18n-engine-agnostic by design**. Every user-visible string is
either slotted content or a prop. Localize in the consumer layer: resolve your
dictionary to plain strings, then pass them in. Do not add a translation engine
inside a component. `locale` props exist only where a component computes an
`Intl`-formatted value itself: `md-date-picker`, `md-number-field`,
`md-meter`, `md-dialog`, and the charts (`md-bar-chart`, `md-line-chart`,
`md-area-chart`, `md-pie-chart`). `md-time-picker` has no
`locale` prop — it takes `format="12h" | "24h"` instead.

Templated strings keep their placeholder tokens when translated — translate
around the braces, don't remove them:

```html
<md-transfer-list count-template="{checked} / {total} ausgewählt"></md-transfer-list>
```

Other templated props: `md-autocomplete status-template`, `md-otp-field
cell-label-template`. Default prop values are English (`Search`, `Dismiss`,
`No results`, `Move selected to target`, …) — every one of them needs
translating in a localized app.

### 4.7 Forms and validation

Fourteen components are form-associated via `ElementInternals`, so they
participate in `FormData` and constraint validation like native controls:

`md-text-field` · `md-number-field` · `md-otp-field` · `md-select` ·
`md-multi-select` · `md-autocomplete` · `md-checkbox` · `md-radio` ·
`md-switch` · `md-slider` · `md-rating` · `md-date-picker` · `md-time-picker` ·
`md-button`

Rules:

- Use a real `<form>`. `md-button type="submit"` calls `form.requestSubmit()`
  (not `submit()`), so the `submit` event fires **and** built-in constraint
  validation runs. `required` genuinely blocks submit.
  `md-button type="reset"` calls `form.reset()`.
- Give every control a `name`, or it will not appear in `FormData`.
- Do **not** add hidden `<input>`s to mirror values — that's the old pattern and
  it double-submits.
- Validity changes are announced on a `mdValidityChange` event on the control.
  Invalid submissions show the platform's message in the control's own inline
  error styling, with no browser validation popover. Correcting or resetting a
  field clears its generated message. `error` + `error-text` remain available
  for app-provided messages and take precedence over generated messages.
  `checkValidity()` checks silently; `reportValidity()` shows inline errors and
  focuses the first invalid control. Core submit buttons and Enter do the same.
- Boolean state props differ by control — `md-checkbox` uses `checked`,
  `md-switch` uses **`selected`**, `md-select-option` uses `selected`. Check the
  manual; guessing `checked` on a switch silently does nothing.

---

## §5 — Component decision matrix

Route by **need**, not by name. If the need isn't listed, find the closest row
and read that component's `When NOT to use`.

### 5.1 Actions

| Need | Use | Don't use |
|---|---|---|
| Discrete labelled action | `md-button` | `md-chip`, raw `<button>` |
| Icon-only action | `md-icon-button` | `md-button` with no label |
| A destructive action | `md-button` + `md-dialog` to confirm | an unconfirmed `filled` button |
| The single most prominent screen action (mobile) | `md-fab` | a second `filled` `md-button` |
| One prominent action that expands to several | `md-fab-menu` + `md-fab-menu-item` | a stack of FABs |
| Primary action + variants of it | `md-split-button` | button + separate menu |
| 2–5 related actions as one unit | `md-button-group` | loose adjacent buttons |
| Mutually exclusive view/mode switch | `md-segmented-button-set` + `md-segmented-button` | radio buttons, tabs |
| Overflow / contextual actions | `md-menu` + `md-menu-item` | a row of text buttons |

### 5.2 Text input

| Need | Use | Don't use |
|---|---|---|
| Any single-line or multi-line text entry | `md-text-field` | raw `<input>` |
| A number with steppers and locale formatting | `md-number-field` | `md-text-field type="number"` |
| A one-time code / PIN | `md-otp-field` | a row of text fields |
| Text entry with suggestions | `md-autocomplete` | `md-select` |
| Site/app-wide search with a results surface | `md-search` | `md-text-field` with an icon |

### 5.3 Selection

| Need | Use | Don't use |
|---|---|---|
| One of many, from a list | `md-select` + `md-select-option` | radio group over ~7 options |
| One of few (2–5), all visible | `md-radio` | `md-select` |
| Several of many | `md-multi-select` | many `md-checkbox`es |
| Several of few, all visible | `md-checkbox` | `md-multi-select` |
| Instant on/off setting | `md-switch` | `md-checkbox` |
| A value in a numeric range | `md-slider` | `md-text-field type=number` |
| Subjective score | `md-rating` | slider |
| A color | `md-color-picker` | `<input type=color>` |
| Assign a subset from a bounded pool, side by side | `md-transfer-list` | two lists + buttons |
| Filter / attribute / removable entry | `md-chip` | small buttons |
| A date | `md-date-picker` | three selects |
| A time | `md-time-picker` | text field |

### 5.4 Navigation

| Need | Use | Don't use |
|---|---|---|
| Top-level destinations, mobile | `md-navigation-bar` + `md-navigation-tab` | tabs |
| Top-level destinations, desktop | `md-navigation-rail` + `md-navigation-rail-tab` | bottom bar |
| App header: title, actions, search | `md-app-bar` | a custom `<header>` |
| A dense action strip | `md-toolbar` | app bar |
| Sibling views **within** one screen | `md-tabs` + `md-tab` + `md-tab-panels` + `md-tab-panel` | navigation bar |
| Hierarchy / where-am-I | `md-breadcrumbs` + `md-breadcrumb-item` | text links |
| A linear multi-step flow | `md-stepper` + `md-step` | tabs |
| Contextual popup actions | `md-menu` + `md-menu-item`, `md-menu-item-group`, `md-sub-menu-item` | dialog |
| Hierarchical command menu (File → Export → PDF) | `md-menu` + `md-sub-menu-item` | nested dialogs |

### 5.5 Containment and feedback

| Need | Use | Don't use |
|---|---|---|
| Group related content | `md-card` | a bare `<div>` with a border |
| Blocking decision or focused task | `md-dialog` | a new page |
| Critical error the user must acknowledge | `md-dialog` | `md-snackbar` |
| Supplementary content from the bottom (mobile) | `md-bottom-sheet` | dialog |
| Supplementary content from the side (desktop) | `md-side-sheet` | dialog |
| Brief confirmation of an action, optionally undoable | `md-snackbar` | dialog, alert |
| Explain a control on hover/focus | `md-tooltip` | a dialog or inline hint |
| Progressive disclosure of sections | `md-accordion` + `md-accordion-item` | tabs |
| Visual separation | `md-divider` | a styled `<hr>` |
| A vertical set of records | `md-list` + `md-list-item` | a table |
| Determinate/indeterminate progress | `md-progress-indicator` | spinner GIF |
| Brand-consistent page/content loading | `md-loading-indicator` | custom spinner |
| Content-shaped loading placeholder | `md-skeleton` | a spinner over the whole page |
| Count or status on an element | `md-badge` | superscript text |
| Compact status dot | `md-status-dot` | a colored emoji |
| Read-only value within a known range (quota, battery) | `md-meter` | `md-progress-indicator` |
| A person or entity image/initials | `md-avatar` | a raw `<img>` |
| Touch feedback inside a custom control | `md-ripple` | custom CSS animation |

### 5.6 Data

| Need | Use | Don't use |
|---|---|---|
| Any table | `md-table-container` wrapping `md-table`, with `-head`/`-body`/`-row`/`-cell`/`-foot` inside the table and `-toolbar`/`-pagination` beside it in the container (§7.1) | a native `<table>` |
| Sorting, selection, paging on that table | the same parts — `md-table` carries the STATE (`sort-by`, `sort-order`, `selection`, `row-offset`, `row-count`, `loading`) and emits events; you own the data and do the actual sorting/paging | expecting it to sort an array for you |
| Hierarchy / reporting lines | `md-organization-chart` | nested lists |
| Compare categories | `md-bar-chart` | pie chart |
| Trend over time | `md-line-chart` | bar chart |
| Trend with cumulative volume | `md-area-chart` | line chart |
| Parts of a whole (≤ ~6 slices) | `md-pie-chart` | bar chart |
| Inline micro-trend in a cell or card | `md-sparkline` | a full chart |

> **There is no data-driven table component.** `md-table` is composable: you
> render the rows. It tracks and announces sort, selection and pagination state
> and emits events when the user changes them, but the sorting, filtering and
> slicing of your data is yours to perform. Render rows from your own array in
> response to those events.

### 5.7 Choosing the variant

The matrix picks the component; this picks its shape. Every value below is a
real enum member — anything not listed here is not a valid value.

| Component | Prop | Values, and when |
|---|---|---|
| `md-button` | `variant` | `filled` the one primary action · `tonal` a strong secondary · `outlined` secondary, and the safe choice for a destructive action behind a confirm · `text` low emphasis, dialog Cancel · `elevated` when it sits on a busy or coloured background (default `filled`) |
| `md-button` / `md-icon-button` / `md-button-group` | `size` | `xs` `sm` `md` `lg` `xl` — default `sm`; go `md`/`lg` for consumer CTAs, `xs`/`sm` for dense admin UI |
| `md-icon-button` | `variant` | `standard` (default) · `filled` · `tonal` · `outlined` |
| `md-button-group` | `variant` | `standard` spaced · `connected` fused into one bar |
| `md-fab` | `size` | `standard` (default) · `medium` · `large` |
| `md-fab` | `variant` | `primary-container` (default) · `secondary-container` · `tertiary-container` · `surface` · `primary` · `secondary` · `tertiary` |
| `md-card` | `variant` | `filled` for a group of comparable items · `elevated` (default) for a hero or featured item · `outlined` for a settings or form section |
| `md-text-field` / `md-select` | `variant` | `outlined` for forms on a surface · `filled` for dense or tinted layouts (`md-text-field` defaults to `filled`, `md-select` to `outlined`) — pick one and use it for every field on the screen |
| `md-text-field` | `type` | any native input type: `password`, `email`, `tel`, `url`, `search`, … (default `text`) |
| `md-text-field` | `multiline` | `"auto-grow"` grows with content · `"fixed"` with `rows` for a fixed comment box · `false` (default) single line |
| `md-search` | `variant` | `contained` (default) · `divided` |
| `md-app-bar` | `variant` | `small` (default) · `medium` · `large` for a prominent headline · `search` for a bar that hosts a field |
| `md-chip` | `variant` | `assist` (default) · `filter` for toggleable facets · `input` for user-entered removable values · `suggestion` |
| `md-chip` | `appearance` | `outlined` (default) · `filled` · `elevated` |
| `md-badge` | `variant` | `small` a bare dot · `large` (default) a count |
| `md-tooltip` | `variant` | `plain` (default) a short label on an icon control · `rich` an explanatory popover that may hold a link or action |
| `md-divider` | — | **no `variant`** — use the booleans `inset`, `inset-start`, `inset-end` |
| `md-side-sheet` | `variant` | `standard` coexists with page content · `modal` overlays with a scrim |
| `md-bottom-sheet` | `variant` | `standard` (default) · `detached` floating above the edge |
| `md-dialog` | `fullscreen` | boolean — a full-screen dialog for a long mobile task |
| `md-date-picker` | `variant` | `modal-input` (default) calendar plus a typed field · `modal` calendar only · `docked` inline, anchored to the field |
| `md-time-picker` | `variant` | `dial` · `input` (default) |
| `md-progress-indicator` | `variant` | `linear` (default) · `circular`; add `indeterminate` when the total is unknown |
| `md-list-item` | `lines` | `1` · `2` · `3` — must match how much supporting text you pass |
| `md-navigation-bar` | — | 3–5 destinations. Fewer than three: use `md-tabs`. More than five: a rail or a menu |
| `md-navigation-rail` | — | 3–7 destinations; cap the overflow with `max-visible` |

### 5.8 Not in the library

Rich text editor · file upload/dropzone · calendar/scheduler view · map ·
toast stack manager (use `md-snackbar` and manage the queue yourself) ·
data grid with virtualized columns. If the user needs one, say so plainly and
integrate a third-party component styled with the MD3 tokens.

**There is no `md-grid`, no `md-data-table`, no `md-layout`, no `md-icon`.**
If a tag is not listed in §6, it does not exist — do not emit it.

---

## §6 — Component inventory

**Every component has exactly one manual, and it is the readme.md in its own
source folder:**

```
./packages/core/src/components/<tag>/readme.md
```

e.g. [`md-select`](./packages/core/src/components/md-select/readme.md),
[`md-button`](./packages/core/src/components/md-button/readme.md).

**Load that file before you use the component.** There is no second, shorter
summary to rely on — this readme is the single source, so anything you do not
read there, you do not know. Each one carries When-to-use, a Do/Don't table
from M3, copy-paste patterns, an anti-patterns table, and the theming surface.

Work through them one at a time: pick the component from the decision matrix
(§5), load its readme, write that component's markup, then move to the next.

The library has 56 components and 25 sub-components, with 81 manuals in total.
Sub-components are only valid inside a parent (a table cell, a tab panel, a
select option). Every sub-component manual names its parent in the first line,
and §7 below summarises the nesting.

`status` in each manual's `llm:meta` block is one of:

- **`md3-mapped`** — has a Material Design 3 guidelines page; the Do/Don't is
  sourced from it.
- **`custom`** — an addition to MD3; guidance is derived house rules.
- **`sub-component`** — only valid inside a specific parent.

| Category | Components |
|---|---|
| Actions | `md-button` `md-icon-button` `md-fab` `md-fab-menu` `md-fab-menu-item` `md-split-button` `md-button-group` `md-segmented-button` `md-segmented-button-set` |
| Text input | `md-text-field` `md-number-field` `md-otp-field` `md-autocomplete` `md-search` |
| Selection | `md-select` `md-select-option` `md-multi-select` `md-checkbox` `md-radio` `md-switch` `md-slider` `md-rating` `md-color-picker` `md-transfer-list` `md-chip` |
| Pickers | `md-date-picker` `md-time-picker` |
| Navigation | `md-app-bar` `md-toolbar` `md-navigation-bar` `md-navigation-tab` `md-navigation-rail` `md-navigation-rail-tab` `md-tabs` `md-tab` `md-tab-panels` `md-tab-panel` `md-breadcrumbs` `md-breadcrumb-item` `md-menu` `md-menu-item` `md-menu-item-group` `md-sub-menu-item` `md-stepper` `md-step` |
| Containment | `md-card` `md-dialog` `md-bottom-sheet` `md-side-sheet` `md-snackbar` `md-tooltip` `md-accordion` `md-accordion-item` `md-divider` `md-list` `md-list-item` |
| Data | `md-table` `md-table-container` `md-table-head` `md-table-body` `md-table-row` `md-table-cell` `md-table-foot` `md-table-toolbar` `md-table-pagination` `md-table-sort-label` `md-table-expand-toggle` `md-organization-chart` |
| Charts | `md-bar-chart` `md-line-chart` `md-area-chart` `md-pie-chart` `md-sparkline` |
| Status & feedback | `md-progress-indicator` `md-loading-indicator` `md-skeleton` `md-badge` `md-status-dot` `md-meter` `md-avatar` `md-ripple` |

---

## §7 — Composition rules

### 7.1 What nests inside what

A sub-component is only valid inside its parent. Putting one anywhere else
produces an unstyled, unregistered-looking element with no keyboard behaviour,
because the parent is what wires roving tabindex, ARIA ids and selection.

| Parent | Children it manages |
|---|---|
| `md-button-group` | `md-button`, `md-icon-button` |
| `md-segmented-button-set` | `md-segmented-button` |
| `md-fab-menu` | `md-fab-menu-item` (anchored to an `md-fab` via `anchor="<id>"`) |
| `md-menu` | `md-menu-item`, `md-sub-menu-item`, `md-menu-item-group` — **not** `md-divider`; separate rows with `md-menu-item`'s own `divider` (or `gap`) prop |
| `md-menu-item-group` | `md-menu-item` |
| `md-sub-menu-item` | a nested `md-menu` in `slot="submenu"` — the items go in *that* menu. There is no default slot, so anything else you nest renders nothing |
| `md-select`, `md-multi-select`, `md-autocomplete` | `md-select-option` |
| `md-list` | `md-list-item`, `md-divider` |
| `md-tabs` | `md-tab` |
| `md-tab-panels` | `md-tab-panel` (one per tab, in tab order) |
| `md-navigation-bar` | `md-navigation-tab` |
| `md-navigation-rail` | `md-navigation-rail-tab`, plus an `md-fab` in `slot="fab"` |
| `md-accordion` | `md-accordion-item` |
| `md-stepper` | `md-step` (horizontal steppers also take `slot="content"`) |
| `md-breadcrumbs` | `md-breadcrumb-item` |
| `md-table-container` | `md-table` — **it wraps the table, not the other way round** — plus `md-table-toolbar` in `slot="top"` and `md-table-pagination` in `slot="bottom"`, which sit outside the scroll region |
| `md-table` | `md-table-head`, `md-table-body`, `md-table-foot` (and bare `md-table-row`). It does **not** accept the container, toolbar or pagination |
| `md-table-head` / `-body` / `-foot` | `md-table-row` |
| `md-table-row` | `md-table-cell`, plus `md-table-expand-toggle` for an expandable row |
| `md-table-cell` | `md-table-sort-label` in a header cell |
| `md-tooltip` | **its trigger** — the tooltip wraps the element it describes in its default slot |
| `md-dialog` | body content in the default slot; `md-button` in `slot="actions"` |
| `md-bottom-sheet` / `md-side-sheet` | content in the default slot; `md-button` in `slot="actions"`; headline in `slot="headline"` |
| `md-app-bar` | `md-icon-button` in `slot="leading"` and `slot="trailing"`; `md-menu` for overflow; a field in `slot="search"` on `variant="search"` |
| `md-toolbar` | `md-icon-button`, `md-button`, `md-button-group`; an `md-fab` in `slot="fab"`; `slot="leading"` / `slot="trailing"` for the end clusters |

### 7.2 Pairs that belong together

These don't nest — they sit next to each other in a working flow. Reaching for
one usually means you want the other.

| This | Goes with | Why |
|---|---|---|
| `md-icon-button` | `md-tooltip` | The tooltip supplies the visible meaning the icon lacks |
| `md-button` (`soft-disabled`) | `md-tooltip` | Explains *why* the action is unavailable |
| `md-fab` | `md-fab-menu` | The FAB is the menu's anchor |
| `md-split-button` | `md-menu` | The trailing half opens it |
| `md-card` | `md-button`, `md-icon-button`, `md-divider` | Footer actions, corner action, internal sections |
| `md-list-item` | `md-checkbox`, `md-switch`, `md-icon-button` | Trailing controls in a selectable or settings row |
| `md-bottom-sheet` / `md-side-sheet` | `md-list` | Action menus and filter panels inside the sheet |
| `md-search` | `md-list`, `md-avatar`, `md-icon-button` | Results in the panel; account and voice/filter affordances in the trailing slot |
| `md-date-picker` | `md-time-picker` | Date + time row for booking and scheduling forms |
| `md-time-picker` | `md-button` | The trigger, when `hide-trigger` is set. The picker **is** its own dialog — don't nest it in another one |
| `md-text-field` | `md-button` | Submit / cancel in the form footer |
| `md-multi-select` / `md-autocomplete` | `md-text-field`, `md-menu`, `md-chip` | The field is the trigger (and inherits its variant, density and error state), the menu is the option surface, chips are the selected values |
| `md-autocomplete` | `md-progress-indicator` | The loading row while suggestions are fetched |
| `md-transfer-list` | `md-checkbox`, `md-text-field`, `md-icon-button` | Per-row select, per-side search, mover controls |
| `md-number-field` | `md-text-field` hooks, `md-icon-button` | It *is* an `md-text-field` internally — every `--md-text-field-*` custom property passes through — and its steppers are `md-icon-button`s |
| `md-otp-field` | `md-button` | Verify action (`auto-submit` covers the no-button flow) |
| Any chart | `md-card` | Charts belong on a dashboard tile |
| `md-line-chart` | `md-segmented-button-set` | Period picker (1W / 1M / 1Y) driving the range |
| `md-sparkline` | `md-list-item`, `md-table-cell` | Trend column beside a value |
| `md-skeleton` | `md-card`, `md-list` | Render N placeholders in the real layout while fetching |
| `md-meter` | `md-chip`, `md-card` | Same semantic status colour on both; quota and usage summaries live on a card |
| `md-color-picker` | `md-text-field`, `md-button` | Label and helper text beside it in a form; save / cancel in the surrounding popover or dialog |
| `md-rating` | `md-text-field`, `md-card` | A rating row in a review form; aggregate scores on a review card |
| `md-accordion` | `md-divider` | Optional inner dividers inside long item content |
| `md-stepper` | `md-button` | Next / back / submit adjacent to the stepper |

### 7.3 Reusable interaction patterns

- **One footer for a dialog wizard.** Set `md-stepper.nav = false` and put
  Back / Continue in the dialog's `actions` slot. Keep the steps in the body;
  the dialog owns scrolling and keeps its header/footer visible. In fullscreen
  mode use the header close button for dismissal. Use a real form and submit
  button so Enter and inline validation follow the same path as a click.
- **Overlay handoffs wait for completion.** Use `await search.close(); await
  search.whenClosed();` before opening a result dialog or unmounting search.
  `mdClose` signals the state change; `whenClosed()` includes motion and cleanup.
  Do not replace that contract with a guessed timeout or a second focus trap.
- **Appearance controls fill their allocated space.** For an inline color picker
  in settings, set `--md-color-picker-width: 100%`. Its compact default remains
  appropriate for a popover. No shadow-DOM width overrides or extra tabindex.
- **Loading belongs to the operation.** Use `md-button.loading` for the initiating
  action and `md-skeleton` with `announce=false` for the content being replaced.
  Preserve the content layout, expose one live status, and guard repeated submits.
  Abort or ignore stale responses when the owner closes or a newer request wins.
  Provide inline error/retry and preserve entered values; do not add artificial waits.
- **Separate routing intent from selection synchronization.** `md-navigation-bar`
  emits `mdChange` for both user and programmatic changes. For a controlled router,
  use each `md-navigation-tab`'s `mdTabClick` for user intent, `manual-activation`
  on the bar, and synchronize `activeIndex` from the confirmed route. Avoid routing
  again merely because browser Back/Forward updated the selected index.
- **Keep table chrome outside the column scroller.** Use `slot="top"` and
  `slot="bottom"` on the toolbar and pagination. Set `min-inline-size: 0` on the
  containing grid/flex child and a readable minimum width on the table. Nested
  controls own their keys; do not add row-level Enter/Space interception in apps.

### 7.4 Nesting that is always wrong

- A dialog opened from inside a dialog. Use `md-stepper` inside **one**
  `md-dialog`.
- A component inside a native interactive element (`<button>`, `<a>`) — it
  nests interactive controls and destroys the accessibility tree. Use the
  component's own `href` / `type` props.
- `md-tabs` used for top-level app navigation. Tabs switch sibling views of the
  same data; destinations are `md-navigation-bar` / `md-navigation-rail`.

---

## §8 — Page recipes

Complete, runnable screens. Each renders as-is once the components are
registered and the token sheet and font links from §3 are loaded — no
placeholder identifiers, no helper functions to write.

### 8.1 Login screen

`<form>` is load-bearing: it is what makes `required` block submit and what
`type="submit"` calls `requestSubmit()` on.

```html
<main style="display: grid; place-items: center; min-block-size: 100dvh; padding: 24px;">
  <form id="login-form" style="inline-size: min(420px, 100%);">
    <md-card variant="elevated" style="padding: 32px; display: flex; flex-direction: column; gap: 20px;">
      <h1 style="margin: 0; font: var(--md-sys-typescale-headline-medium-font);">Sign in</h1>

      <md-text-field
        variant="outlined"
        label="Email"
        type="email"
        name="email"
        autocomplete="username"
        required
      ></md-text-field>

      <md-text-field
        variant="outlined"
        label="Password"
        type="password"
        name="password"
        autocomplete="current-password"
        password-toggle="internal"
        required
      ></md-text-field>

      <md-button variant="filled" type="submit" full-width>Sign in</md-button>
      <md-button variant="text" href="/forgot-password">Forgot password?</md-button>
    </md-card>
  </form>
</main>

<script type="module">
  document.getElementById('login-form').addEventListener('submit', (e) => {
    e.preventDefault();
    const data = new FormData(e.currentTarget);
    console.log(data.get('email'), data.get('password'));
  });
</script>
```

### 8.2 Settings page (mobile)

Top app bar + grouped rows of instant-apply switches. `md-switch` uses
**`selected`**, not `checked`. The rows are `type="text"` (non-interactive), so
the switch is the only control — one tab stop per setting.

```html
<md-app-bar variant="small" headline="Settings">
  <md-icon-button slot="leading" icon="arrow_back" aria-label="Back"></md-icon-button>
</md-app-bar>

<main style="padding: 16px; display: flex; flex-direction: column; gap: 16px;">
  <md-card variant="outlined">
    <md-list>
      <md-list-item headline="Notifications" supporting-text="Push, email, in-app" lines="2">
        <md-switch slot="trailing" selected aria-label="Enable notifications" data-setting="notifications"></md-switch>
      </md-list-item>
      <md-divider></md-divider>
      <md-list-item headline="Dark mode" supporting-text="Match system" lines="2">
        <md-switch slot="trailing" aria-label="Enable dark mode" data-setting="dark"></md-switch>
      </md-list-item>
      <md-divider></md-divider>
      <md-list-item headline="Sync over cellular">
        <md-switch slot="trailing" selected aria-label="Sync over cellular" data-setting="cellular"></md-switch>
      </md-list-item>
    </md-list>
  </md-card>
</main>

<md-snackbar id="settings-toast" message="Setting saved"></md-snackbar>

<script type="module">
  const toast = document.getElementById('settings-toast');
  document.querySelectorAll('md-switch[data-setting]').forEach((sw) => {
    sw.addEventListener('mdChange', (e) => {
      if (sw.dataset.setting === 'dark') {
        document.documentElement.setAttribute('data-theme', e.detail.selected ? 'dark' : 'light');
      }
      toast.show();
    });
  });
</script>
```

### 8.3 Settings form (deferred save, with validation)

When settings are saved on submit rather than applied instantly, use a real
form. `required` blocks the submit; every control needs a `name` to reach
`FormData`.

```html
<form id="profile-form" style="max-inline-size: 560px; margin: 24px auto; padding: 0 16px;">
  <md-card variant="outlined" style="padding: 24px; display: flex; flex-direction: column; gap: 20px;">
    <h2 style="margin: 0; font: var(--md-sys-typescale-title-large-font);">Profile</h2>

    <md-text-field
      variant="outlined"
      label="Display name"
      name="displayName"
      required
      supporting-text="Shown on your public profile"
    ></md-text-field>

    <md-select variant="outlined" label="Language" name="language" value="en" required>
      <md-select-option value="en" label="English"></md-select-option>
      <md-select-option value="de" label="Deutsch"></md-select-option>
      <md-select-option value="ar" label="العربية"></md-select-option>
    </md-select>

    <!-- md-checkbox has NO label slot. It is a labelable, form-associated
         element: wrap it in a native <label> (which names it AND forwards
         clicks), or give the host an aria-label. Text between the tags is
         NOT rendered. -->
    <label style="display: inline-flex; align-items: center; gap: 12px; cursor: pointer;">
      <md-checkbox name="newsletter" value="yes" supporting-text="Monthly, no more"></md-checkbox>
      <span>Send me product news</span>
    </label>

    <div style="display: flex; gap: 8px; justify-content: flex-end;">
      <md-button variant="text" type="reset">Reset</md-button>
      <md-button variant="filled" type="submit">Save changes</md-button>
    </div>
  </md-card>
</form>

<md-snackbar id="saved-toast" message="Changes saved" action="Undo"></md-snackbar>

<script type="module">
  const form = document.getElementById('profile-form');
  const toast = document.getElementById('saved-toast');

  form.addEventListener('submit', (e) => {
    e.preventDefault();
    const data = Object.fromEntries(new FormData(form));
    console.log(data); // { displayName, language, newsletter? }
    toast.show();
  });

  toast.addEventListener('mdAction', () => form.reset());
</script>
```

### 8.4 Dashboard with a FAB

```html
<md-app-bar variant="medium" headline="Inbox">
  <md-icon-button slot="trailing" icon="search" aria-label="Search"></md-icon-button>
  <md-icon-button slot="trailing" icon="filter_list" aria-label="Filter"></md-icon-button>
</md-app-bar>

<main style="padding: 16px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));">
  <md-card variant="filled" interactive style="padding: 16px;">
    <strong>Acme contract</strong>
    <p style="margin: 4px 0 0; color: var(--md-sys-color-on-surface-variant);">Renewal due in 5 days</p>
  </md-card>
  <md-card variant="filled" interactive style="padding: 16px;">
    <strong>Q4 report draft</strong>
    <p style="margin: 4px 0 0; color: var(--md-sys-color-on-surface-variant);">Shared by Alex</p>
  </md-card>
</main>

<md-fab
  icon="add"
  aria-label="New item"
  style="position: fixed; inset-block-end: 16px; inset-inline-end: 16px; z-index: var(--md-sys-z-index-navigation);"
></md-fab>
```

`inset-inline-end` (not `right`) is what keeps the FAB in the correct corner
under `dir="rtl"`.

### 8.5 Destructive confirmation dialog

`md-dialog` traps focus and returns it to the trigger on close — do not add your
own focus management. The error colouring goes through the button's own custom
properties, never a hex.

```html
<md-button id="open-delete" variant="outlined">Delete account</md-button>

<md-dialog id="confirm-delete" headline="Delete account?" icon="warning">
  <p style="margin: 0;">
    This will permanently delete your account and all associated data.
    This action cannot be undone.
  </p>
  <md-button id="cancel-delete" slot="actions" variant="text">Cancel</md-button>
  <md-button
    id="do-delete"
    slot="actions"
    variant="filled"
    style="--md-button-container-color: var(--md-sys-color-error);
           --md-button-label-color: var(--md-sys-color-on-error);"
  >Delete</md-button>
</md-dialog>

<script type="module">
  const dialog = document.getElementById('confirm-delete');
  document.getElementById('open-delete').addEventListener('mdClick', () => dialog.show());
  document.getElementById('cancel-delete').addEventListener('mdClick', () => dialog.close());
  document.getElementById('do-delete').addEventListener('mdClick', () => {
    dialog.close();
    // perform the deletion
  });
</script>
```

If you omit `slot="actions"` entirely, `md-dialog` renders its own Cancel / OK
pair (labels via `cancel-label` / `ok-label`) and closes itself.

### 8.6 Tabbed content page

`md-tab-panels` finds the nearest preceding `md-tabs` (or the one named by
`for`), follows its `mdTabChange`, and wires `aria-controls` /
`aria-labelledby` both ways. **No JavaScript is required**, and `md-tab` has no
`value` or `selected` prop — selection lives on `md-tabs` as `active-tab-index`.

```html
<md-tabs id="profile-tabs" aria-label="Profile sections" active-tab-index="0">
  <md-tab label="Posts"></md-tab>
  <md-tab label="Replies"></md-tab>
  <md-tab label="Likes" badge="3"></md-tab>
</md-tabs>

<md-tab-panels for="profile-tabs">
  <md-tab-panel style="padding: 16px;">
    <p style="margin: 0;">Your posts appear here.</p>
  </md-tab-panel>
  <md-tab-panel style="padding: 16px;">
    <p style="margin: 0;">Your replies appear here.</p>
  </md-tab-panel>
  <md-tab-panel style="padding: 16px;">
    <p style="margin: 0;">Posts you liked appear here.</p>
  </md-tab-panel>
</md-tab-panels>
```

To react to the switch (lazy-loading a panel, for example), listen on the tabs:

```js
document.getElementById('profile-tabs')
  .addEventListener('mdTabChange', (e) => console.log(e.detail.index, e.detail.previousIndex));
```

### 8.7 The full recipe library

Twenty-two more complete screens live in the documentation, each with a live
demo, the full markup, framework tabs, and production notes. When the user's
request matches one of these, read that page (append the slug to
`https://awc-ui.dev/recipes/`) instead of composing from scratch:

| Recipe slug | Screen |
|---|---|
| `two-factor-verification` | OTP entry, resend countdown, backup-codes dialog |
| `kpi-overview` | Stat tiles with sparklines + charts under a range switcher |
| `data-grid-console` | Bulk-action data table: filters, selection, undo |
| `server-fleet-status` | Table of hosts with meters, sparklines, status dots |
| `release-health-drilldown` | Table row → side-sheet master-detail with charts |
| `csv-import-wizard` | Stepper: upload, map columns, validate, import |
| `role-permission-assignment` | Transfer-list permissions with confirm dialog |
| `org-chart-explorer` | Searchable org chart with side-sheet profiles |
| `moderation-queue` | Verdict controls, confidence meter, card queue |
| `checkout-wizard` | Three-step commerce checkout with validation |
| `appointment-booking` | Date + time pickers inside a stepper flow |
| `survey-nps` | Paged survey using every input control |
| `notification-preferences` | Accordion × switch matrix, quiet hours |
| `app-shell` | Responsive rail/bar chrome, SSR-ready, zero CLS |
| `inbox-shell` | Three-zone list + reading-pane layout |
| `mobile-filter-sheet` | Bottom-sheet filters with applied-chip row |
| `product-reviews` | Rating input + per-star meter breakdown |
| `order-tracking` | Shipment timeline stepper with progress meter |
| `portfolio-markets` | Finance charts + holdings table + trade ticket |
| `pricing-page` | Plan cards, billing toggle, comparison table |
| `async-feedback-patterns` | Skeleton/progress/snackbar choreography rules |
| `charts-gallery` | Every chart component, live-retheming palette |

---

## §9 — Universal do's and don'ts

Apply to every component. Component-specific rules live in each manual.

### 9.1 API and styling

| ✅ Do | ❌ Don't |
|---|---|
| Use the custom element directly — it *is* the control, with its own `href` / `type` props | Wrap it in a native `<button>` / `<a>` (§7.3) |
| Set arrays and objects as **JS properties** (`el.items = [...]`) | Pass them as HTML attributes — they won't parse |
| Theme via `--md-<component>-*` properties, then `::part()` | Reach into shadow internals or override `.md-*` classes |
| Change appearance through design tokens (§4.1) | Hardcode hex colors, px spacing, shadows, or font stacks |
| Use `--md-sys-z-index-*` for your own overlays | Invent z-indexes that land under a menu |
| Use logical CSS (`margin-inline-start`, `inset-inline-end`) | Use `margin-left`, `right`, `padding-right` |
| Set `data-density` / `data-theme` / `dir` once, globally | Set them per component unless you mean a local exception |
| Listen to the component's `md*` events | Rely on native `click` — it fires even when the component's `disabled` / `loading` guard suppressed the action |
| Check the manual for the state prop name | Assume `checked`; `md-switch` uses `selected` |
| Render the element, then call its `@Method` | Call `.show()` on an element not yet in the DOM |

Toggling components flip their own state on activation and *then* emit. On
`md-button`, `mdClick` is cancelable — `preventDefault()` on it vetoes the
toggle and any navigation. `mdChange` fires after the flip and is not
cancelable. If a controlled parent rejects a change it must revert the child
explicitly.

`md-button` has a **toggle mode**: set `toggle` and the button flips its own
`selected` on each activation and exposes `aria-pressed`. `selected` is the
state, not the switch — set it for the initial pressed state and read it back
from `mdClick`'s `detail.selected`. Setting `toggle` and then styling
"pressed" yourself, or setting `selected` without `toggle` (which emits no
`aria-pressed` at all), both produce a control that lies to assistive tech.

### 9.2 Content and hierarchy

| ✅ Do | ❌ Don't |
|---|---|
| Use sentence case for all labels | Uppercase or title-case UI text |
| Keep one high-emphasis action per screen region | Compete `filled` buttons against each other |
| Use `soft-disabled` + `md-tooltip` for contextually-unavailable actions | Use `disabled` and remove it from tab order with no explanation |
| Localize every text prop and `aria-label` | Leave default English prop values in a translated app |

**`disabled` vs `soft-disabled`.** Both render the disabled appearance, but
`disabled` also removes the control from the tab order, so a keyboard or screen
reader user can never find out *why* it is off. `soft-disabled` keeps the
control focusable and announced while still blocking activation — which is what
lets an `md-tooltip` on it explain the gate. Use it whenever the reason is
informative rather than obvious.

Nesting rules — dialog inside a dialog, a component inside a native
`<button>` / `<a>`, tabs used as app navigation — live in §7.3.

### 9.3 Accessibility contract

The library ships WCAG 2.1 AA keyboard and ARIA wiring by default. These are the
rules you must not break:

1. **Every icon-only control gets an accessible name.** `md-icon-button`,
   `md-fab`, and icon-only `md-tab` are nameless without `aria-label` (or
   `aria-labelledby`). `md-fab` will also accept `label`, and warns in the
   console when it has neither.
2. **Every form field gets a `label` prop.** `placeholder` is not a label — it
   disappears on type.
3. **Don't break the tab order.** Every interactive control must be reachable by
   Tab and operable by Enter/Space. If you add `tabindex="-1"` to anything,
   have a reason.
4. **Don't write your own focus trap.** `md-dialog`, `md-bottom-sheet` and
   `md-side-sheet` trap focus while open and restore it to the trigger on
   close — including across shadow boundaries. Adding your own fights theirs.
5. **Don't wrap components in your own live regions.** `md-snackbar` announces
   itself (`politeness="polite"` by default, `"assertive"` when the message must
   interrupt). For an error that blocks the task, use `md-dialog`.
6. **Don't disable motion yourself.** Components honour
   `prefers-reduced-motion: reduce` internally.
7. **Directional icons do not auto-flip in RTL** — see §4.5.
8. **Re-verify contrast after overriding any colour role** — the library's AA
   testing covers the shipped palette only. The Theme Generator at
   <https://awc-ui.dev/theme-generator> runs the WCAG checks live (§4.2).

---

## §10 — Before you ship

Use the checks relevant to the affected components and behavior. For a small
fix, verify the changed interaction and nearby regressions; a new app or broad
change needs wider coverage. Do not turn a focused edit into an unrelated
full-app audit.

1. **Every icon-only control has an accessible name.**
2. **Keyboard-only pass**: reach and operate every control; focus is always
   visible; no traps in dialogs/menus/sheets; focus returns to the trigger.
3. **Theme pass**: light *and* dark, if both are supported — and the attribute
   is set before first paint.
4. **RTL pass**, if an RTL locale ships — check directional icons specifically,
   and grep your own CSS for physical properties.
5. **Density pass** at the configured rung — no clipped labels, touch targets
   still adequate. Remember `density="0"` is inert; use
   `--md-sys-density-scale: 0` to opt a subtree out.
6. **Forms**: every control has a `name`; `required` blocks submit; `FormData`
   contains every field; reset works.
7. **No hardcoded strings** left in markup if the app is localized — including
   default prop values like `Search`, `Dismiss`, `No results`.
8. **No hardcoded design values** — grep the diff for hex colours, `px` radii,
   `box-shadow`, and `z-index` literals.
9. **Contrast** re-verified against AA if colour roles were overridden.
10. **SSR**: if server-rendered, confirm no hydration mismatch and that content
    is present with JS disabled.
11. **No shadow-internal CSS** — only tokens, custom properties, and `::part()`.
12. **Every `md-*` tag you emitted appears in §6.** If it doesn't, it doesn't
    exist.


## MCP server and reusable skills

Core provides a read-only MCP server (`@awc-ui/mcp`) and `awc-ui-build` / `awc-ui-review` skills. MCP tools `search_components`, `get_component`, `list_guides`, and `get_guide` expose versioned Core documentation. Match the reported Core version to the consumer installation; use local manuals when versions differ. The server is optional and grants no permission for project mutations.

The Core package ships skills in `skills/`; `awc-ui ai-setup --skills` installs them under the consumer project’s `.agents/skills/` without overwriting customized copies. For configuration and skill-installer availability, see [AI integration](https://awc-ui.dev/guides/building-with-ai/#optional-mcp-and-skills). Use existing project and user decisions rather than restarting discovery for a focused edit.