md-select 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.
Pick exactly one value from a list. A md-text-field
trigger with a md-menu dropdown, optional in-menu
filtering, async option loading, and row virtualization for large lists.
Form-associated via ElementInternals, with full constraint validation.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Priority" value="med" style="min-width: 220px;">
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high" supporting-text="Pages on-call">High</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Priority" value="med" style={{ minWidth: '220px' }}>
<MdSelectOption value="low">Low</MdSelectOption>
<MdSelectOption value="med">Medium</MdSelectOption>
<MdSelectOption value="high" supportingText="Pages on-call">High</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Priority" value="med" style="min-width: 220px;">
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high" supporting-text="Pages on-call">High</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Priority" value="med" style="min-width: 220px;">
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high" supporting-text="Pages on-call">High</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Priority" value="med" style="min-width: 220px;">
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high" supporting-text="Pages on-call">High</md-select-option>
</md-select>
Already installed? See the
Installation guide for one-time package setup
(core + tokens, fonts). Each tab below shows two patterns for using
md-select 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-select) ─── -->
<script type="module">
import '@awc-ui/core/components/md-select';
</script>
<md-select></md-select>// ─── Option A: typed React wrapper (registers all components) ───
// Importing from '@awc-ui/react' calls defineCustomElements() as a
// side effect, so every md-* element becomes available in the browser.
import { MdSelect } from '@awc-ui/react';
export function Example() {
return <MdSelect></MdSelect>;
}
// ─── Option B: single import (tree-shake to only md-select) ───
// Skip the wrapper and use the raw custom element. Smallest bundle,
// but you lose typed props/events on JSX.
import '@awc-ui/core/components/md-select';
export function ExampleTreeShaken() {
return <md-select></md-select>;
}// ─── Option A: schema module (any md-* element accepted) ───
// Pair with `defineCustomElements(window)` in main.ts.
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `<md-select></md-select>`,
})
export class ExampleComponent {}
// ─── Option B: typed directive (tree-shake friendly) ───
// Pair with `import '@awc-ui/core/components/md-select'` in main.ts.
import { Component } from '@angular/core';
import { MdSelect } from '@awc-ui/angular';
@Component({
standalone: true,
imports: [MdSelect],
template: `<md-select></md-select>`,
})
export class ExampleTreeShakenComponent {}<!-- ─── Option A: typed Vue wrapper (registers all components) ─── -->
<script setup lang="ts">
import { MdSelect } from '@awc-ui/vue';
</script>
<template>
<MdSelect></MdSelect>
</template>
<!-- ─── Option B: single import (tree-shake to only md-select) ─── -->
<script setup lang="ts">
import '@awc-ui/core/components/md-select';
</script>
<template>
<md-select></md-select>
</template><!-- ─── Option A: global registration (done once in main entry) ─── -->
<!-- main.ts: -->
<!-- import { defineCustomElements } from '@awc-ui/svelte'; -->
<!-- defineCustomElements(window); -->
<md-select></md-select>
<!-- ─── Option B: single import (tree-shake to only md-select) ─── -->
<script lang="ts">
import '@awc-ui/core/components/md-select';
</script>
<md-select></md-select>| Situation | Use instead |
|---|---|
| Five or fewer options that should all be visible | md-radio |
| Several values may be chosen | md-select-option · |
md-multi-select | |
| The user types free text with suggestions | md-autocomplete |
| 2–5 exclusive view/mode options | md-segmented-button |
| A date or a time | md-date-picker / md-time-picker |
| Running actions rather than choosing a value | md-menu |
| A boolean | md-switch / md-checkbox |
| Need | Setting |
|---|---|
| Options written in markup | md-select-option children |
| Options from data or a fetch | The options property |
| Filled field | variant="filled" |
| A clear affordance | clearable |
| An in-menu search box | filterable |
| Thousands of rows | virtualize |
| Menu as wide as the trigger | match-trigger-width |
| Compact trigger and rows | density="-1…-4" |
Arrays don’t cross the attribute boundary, so options must be set as a JS
property:
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select id="country" label="Country"></md-select>
<script type="module">
const select = document.getElementById('country');
// Arrays don't cross the attribute boundary — set it as a property.
select.options = countries.map((c) => ({ value: c.code, label: c.name }));
select.value = 'de';
</script>import { MdSelect } from '@awc-ui/react';
// Arrays don't cross the attribute boundary — set it as a property.
const options = countries.map((c) => ({ value: c.code, label: c.name }));
const value = 'de';
export function Demo() {
return (
<>
<MdSelect id="country"
options={options}
value={value} label="Country"></MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
// app.component.ts — the bound values live on the class
import { Component } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent {
options = countries.map((c) => ({ value: c.code, label: c.name }));
value = 'de';
}
<!-- app.component.html -->
<md-select id="country"
[options]="options"
[value]="value" label="Country"></md-select><script setup>
import '@awc-ui/core/define';
const options = countries.map((c) => ({ value: c.code, label: c.name }));
const value = 'de';
</script>
<template>
<md-select id="country"
:options="options"
:value="value" label="Country"></md-select>
</template><script>
import '@awc-ui/core/define';
const options = countries.map((c) => ({ value: c.code, label: c.name }));
const value = 'de';
</script>
<md-select id="country"
{options}
{value} label="Country"></md-select>value is a single string, not an array. getLabels(values) resolves
values back to display labels.
md-select-option is a declarative data carrier, shared with
md-multi-select. It renders nothing
(:host { display: none }) — the parent reads its props and projects them into
its own md-menu as real md-menu-item rows.
<!-- 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-select label="Priority" value="med" style="min-inline-size: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)">High</md-select-option>
</md-select>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Priority" value="med" style={{ minInlineSize: '260px' }}>
<MdSelectOption value="low" icon="arrow_downward">Low</MdSelectOption>
<MdSelectOption value="med" icon="remove">Medium</MdSelectOption>
<MdSelectOption value="high" icon="arrow_upward" iconColor="var(--md-sys-color-error)">High</MdSelectOption>
</MdSelect>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Priority" value="med" style="min-inline-size: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)">High</md-select-option>
</md-select><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Priority" value="med" style="min-inline-size: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)">High</md-select-option>
</md-select>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-select label="Priority" value="med" style="min-inline-size: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)">High</md-select-option>
</md-select>md-menu, so reach it with the select’s parts and custom properties.label falls back to the slotted text when it is empty.selected is a hint — honoured only while the parent’s own value is
unset. If the select has a value, the select wins.value. Matching and every emitted payload
depend on it — translate the label and supporting-text, keep value
untranslated.<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Country" placeholder="Choose…" style="min-width: 240px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
<md-select-option value="es" supporting-text="Ships in 3 days">Spain</md-select-option>
<md-select-option value="it" disabled>Italy</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Country" placeholder="Choose…" style={{ minWidth: '240px' }}>
<MdSelectOption value="fr">France</MdSelectOption>
<MdSelectOption value="de">Germany</MdSelectOption>
<MdSelectOption value="es" supportingText="Ships in 3 days">Spain</MdSelectOption>
<MdSelectOption value="it" disabled>Italy</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Country" placeholder="Choose…" style="min-width: 240px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
<md-select-option value="es" supporting-text="Ships in 3 days">Spain</md-select-option>
<md-select-option value="it" disabled>Italy</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Country" placeholder="Choose…" style="min-width: 240px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
<md-select-option value="es" supporting-text="Ships in 3 days">Spain</md-select-option>
<md-select-option value="it" disabled>Italy</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Country" placeholder="Choose…" style="min-width: 240px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
<md-select-option value="es" supporting-text="Ships in 3 days">Spain</md-select-option>
<md-select-option value="it" disabled>Italy</md-select-option>
</md-select>outlined is the default.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select variant="outlined" label="Outlined" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
<md-select variant="filled" label="Filled" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect variant="outlined" label="Outlined" value="a" style={{ minWidth: '200px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
<MdSelectOption value="b">Option B</MdSelectOption>
</MdSelect>
<MdSelect variant="filled" label="Filled" value="a" style={{ minWidth: '200px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
<MdSelectOption value="b">Option B</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select variant="outlined" label="Outlined" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
<md-select variant="filled" label="Filled" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select variant="outlined" label="Outlined" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
<md-select variant="filled" label="Filled" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select variant="outlined" label="Outlined" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
<md-select variant="filled" label="Filled" value="a" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>Options carry an icon, an icon-color and a supporting-text second line.
Use icons consistently — all rows or none.
<!-- 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-select label="Priority" value="high" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward" supporting-text="Next sprint">Low</md-select-option>
<md-select-option value="med" icon="remove" supporting-text="This week">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)" supporting-text="Pages on-call">High</md-select-option>
</md-select>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Priority" value="high" style={{ minWidth: '260px' }}>
<MdSelectOption value="low" icon="arrow_downward" supportingText="Next sprint">Low</MdSelectOption>
<MdSelectOption value="med" icon="remove" supportingText="This week">Medium</MdSelectOption>
<MdSelectOption value="high" icon="arrow_upward" iconColor="var(--md-sys-color-error)" supportingText="Pages on-call">High</MdSelectOption>
</MdSelect>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Priority" value="high" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward" supporting-text="Next sprint">Low</md-select-option>
<md-select-option value="med" icon="remove" supporting-text="This week">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)" supporting-text="Pages on-call">High</md-select-option>
</md-select><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Priority" value="high" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward" supporting-text="Next sprint">Low</md-select-option>
<md-select-option value="med" icon="remove" supporting-text="This week">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)" supporting-text="Pages on-call">High</md-select-option>
</md-select>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-select label="Priority" value="high" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward" supporting-text="Next sprint">Low</md-select-option>
<md-select-option value="med" icon="remove" supporting-text="This week">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward" icon-color="var(--md-sys-color-error)" supporting-text="Pages on-call">High</md-select-option>
</md-select>error-text replaces supporting-text when error is set — never show
both. reserve-supporting-space keeps the message line’s height allocated so
the layout doesn’t jump when an error appears.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Enabled" value="a" supporting-text="Where you're billed" style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Disabled" value="a" disabled style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Country" required error error-text="Select a country" reserve-supporting-space style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Enabled" value="a" supportingText="Where you're billed" style={{ minWidth: '210px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Disabled" value="a" disabled style={{ minWidth: '210px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Country" required error errorText="Select a country" reserveSupportingSpace style={{ minWidth: '210px' }}>
<MdSelectOption value="fr">France</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Enabled" value="a" supporting-text="Where you're billed" style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Disabled" value="a" disabled style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Country" required error error-text="Select a country" reserve-supporting-space style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Enabled" value="a" supporting-text="Where you're billed" style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Disabled" value="a" disabled style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Country" required error error-text="Select a country" reserve-supporting-space style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Enabled" value="a" supporting-text="Where you're billed" style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Disabled" value="a" disabled style="min-width: 210px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Country" required error error-text="Select a country" reserve-supporting-space style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
</md-select>clearable adds a clear affordance. filterable renders a search box inside
the menu — turn it on past roughly 15 options. loading shows the progress
affordance while options are being fetched.
filterable works whichever way the options were supplied. A plain list filters
client-side on label or supporting text, case-insensitively and immediately;
a virtualized one filters inside the WASM engine, debounced, with a spinner. No
match shows no-results-text, and closing the menu clears the query — the field
is uncontrolled and unmounts with the menu, so reopening shows the full list.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Clearable" value="fr" clearable style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-select label="Filterable" filterable search-placeholder="Search…" filter-label="Filter countries" style="min-width: 210px;">
<md-select-option value="fr" supporting-text="Paris">France</md-select-option>
<md-select-option value="de" supporting-text="Berlin">Germany</md-select-option>
<md-select-option value="es" supporting-text="Madrid">Spain</md-select-option>
</md-select>
<md-select label="Loading" loading loading-text="Loading…" style="min-width: 210px;"></md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Clearable" value="fr" clearable style={{ minWidth: '210px' }}>
<MdSelectOption value="fr">France</MdSelectOption>
<MdSelectOption value="de">Germany</MdSelectOption>
</MdSelect>
<MdSelect label="Filterable" filterable searchPlaceholder="Search…" filterLabel="Filter countries" style={{ minWidth: '210px' }}>
<MdSelectOption value="fr" supportingText="Paris">France</MdSelectOption>
<MdSelectOption value="de" supportingText="Berlin">Germany</MdSelectOption>
<MdSelectOption value="es" supportingText="Madrid">Spain</MdSelectOption>
</MdSelect>
<MdSelect label="Loading" loading loadingText="Loading…" style={{ minWidth: '210px' }}></MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Clearable" value="fr" clearable style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-select label="Filterable" filterable search-placeholder="Search…" filter-label="Filter countries" style="min-width: 210px;">
<md-select-option value="fr" supporting-text="Paris">France</md-select-option>
<md-select-option value="de" supporting-text="Berlin">Germany</md-select-option>
<md-select-option value="es" supporting-text="Madrid">Spain</md-select-option>
</md-select>
<md-select label="Loading" loading loading-text="Loading…" style="min-width: 210px;"></md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Clearable" value="fr" clearable style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-select label="Filterable" filterable search-placeholder="Search…" filter-label="Filter countries" style="min-width: 210px;">
<md-select-option value="fr" supporting-text="Paris">France</md-select-option>
<md-select-option value="de" supporting-text="Berlin">Germany</md-select-option>
<md-select-option value="es" supporting-text="Madrid">Spain</md-select-option>
</md-select>
<md-select label="Loading" loading loading-text="Loading…" style="min-width: 210px;"></md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Clearable" value="fr" clearable style="min-width: 210px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-select label="Filterable" filterable search-placeholder="Search…" filter-label="Filter countries" style="min-width: 210px;">
<md-select-option value="fr" supporting-text="Paris">France</md-select-option>
<md-select-option value="de" supporting-text="Berlin">Germany</md-select-option>
<md-select-option value="es" supporting-text="Madrid">Spain</md-select-option>
</md-select>
<md-select label="Loading" loading loading-text="Loading…" style="min-width: 210px;"></md-select>Slot your own affordance into loader when the default spinner isn’t what you
want — a circular md-progress-indicator, a
branded mark, a skeleton. Everything else about the loading state is unchanged.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Default loader" loading loading-text="Loading…" style="min-width: 210px;"></md-select>
<md-select label="Slotted loader" loading loading-text="Loading…" style="min-width: 210px;">
<md-progress-indicator slot="loader" variant="circular" indeterminate size="24" label="Loading"></md-progress-indicator>
</md-select>import { MdProgressIndicator, MdSelect } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Default loader" loading loadingText="Loading…" style={{ minWidth: '210px' }}></MdSelect>
<MdSelect label="Slotted loader" loading loadingText="Loading…" style={{ minWidth: '210px' }}>
<MdProgressIndicator slot="loader" variant="circular" indeterminate size="24" label="Loading"></MdProgressIndicator>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Default loader" loading loading-text="Loading…" style="min-width: 210px;"></md-select>
<md-select label="Slotted loader" loading loading-text="Loading…" style="min-width: 210px;">
<md-progress-indicator slot="loader" variant="circular" indeterminate size="24" label="Loading"></md-progress-indicator>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Default loader" loading loading-text="Loading…" style="min-width: 210px;"></md-select>
<md-select label="Slotted loader" loading loading-text="Loading…" style="min-width: 210px;">
<md-progress-indicator slot="loader" variant="circular" indeterminate size="24" label="Loading"></md-progress-indicator>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Default loader" loading loading-text="Loading…" style="min-width: 210px;"></md-select>
<md-select label="Slotted loader" loading loading-text="Loading…" style="min-width: 210px;">
<md-progress-indicator slot="loader" variant="circular" indeterminate size="24" label="Loading"></md-progress-indicator>
</md-select>For server-side search, combine setQuery() with loadOptions() and drive
loading yourself. setQuery(q) filters the menu exactly as typing into the
in-menu search field would, and fills that field with q so the two agree —
call it after loadOptions() resolves, since loading replaces the whole
option set and would overwrite the filter.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select id="airport" label="Airport" filterable loading-text="Searching…"></md-select>
<script type="module">
const select = document.getElementById('airport');
const load = async (q) => {
select.loading = true;
// await it: loadOptions resolves once the store has finished packing, and
// filtering before that runs against a store that is still loading.
await select.loadOptions(await fetchPage(q)); // your endpoint
select.loading = false;
};
// Fetch the first page when the menu opens, once — loadOptions() replaces the
// whole option set, so a later fetch would overwrite an applied filter.
let loaded = null;
const ensureLoaded = () => (loaded ??= load(''));
select.addEventListener('mdOpen', ensureLoaded);
// …and drive the in-menu search box yourself when you have a query.
// setQuery() filters the menu AND fills the search field, exactly as typing
// would — after the options are in.
await ensureLoaded();
select.setQuery('fra');
</script>import { useEffect, useRef } from 'react';
import { MdSelect } from '@awc-ui/react';
export function Demo() {
const selectRef = useRef(null);
useEffect(() => {
const select = selectRef.current;
const load = async (q) => {
select.loading = true;
// await it: loadOptions resolves once the store has finished packing, and
// filtering before that runs against a store that is still loading.
await select.loadOptions(await fetchPage(q)); // your endpoint
select.loading = false;
};
// Fetch the first page when the menu opens, once — loadOptions() replaces the
// whole option set, so a later fetch would overwrite an applied filter.
let loaded = null;
const ensureLoaded = () => (loaded ??= load(''));
select.addEventListener('mdOpen', ensureLoaded);
// …and drive the in-menu search box yourself when you have a query.
// setQuery() filters the menu AND fills the search field, exactly as typing
// would — after the options are in.
await ensureLoaded();
select.setQuery('fra');
}, []);
return (
<>
<MdSelect id="airport" ref={selectRef} label="Airport" filterable loadingText="Searching…"></MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
// app.component.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
@ViewChild('select') selectRef!: ElementRef;
ngAfterViewInit() {
const select = this.selectRef.nativeElement;
const load = async (q) => {
select.loading = true;
// await it: loadOptions resolves once the store has finished packing, and
// filtering before that runs against a store that is still loading.
await select.loadOptions(await fetchPage(q)); // your endpoint
select.loading = false;
};
// Fetch the first page when the menu opens, once — loadOptions() replaces the
// whole option set, so a later fetch would overwrite an applied filter.
let loaded = null;
const ensureLoaded = () => (loaded ??= load(''));
select.addEventListener('mdOpen', ensureLoaded);
// …and drive the in-menu search box yourself when you have a query.
// setQuery() filters the menu AND fills the search field, exactly as typing
// would — after the options are in.
await ensureLoaded();
select.setQuery('fra');
}
}
<!-- app.component.html -->
<md-select id="airport" #select label="Airport" filterable loading-text="Searching…"></md-select><script setup>
import { onMounted, ref } from 'vue';
import '@awc-ui/core/define';
const selectRef = ref(null);
onMounted(() => {
const select = selectRef.value;
const load = async (q) => {
select.loading = true;
// await it: loadOptions resolves once the store has finished packing, and
// filtering before that runs against a store that is still loading.
await select.loadOptions(await fetchPage(q)); // your endpoint
select.loading = false;
};
// Fetch the first page when the menu opens, once — loadOptions() replaces the
// whole option set, so a later fetch would overwrite an applied filter.
let loaded = null;
const ensureLoaded = () => (loaded ??= load(''));
select.addEventListener('mdOpen', ensureLoaded);
// …and drive the in-menu search box yourself when you have a query.
// setQuery() filters the menu AND fills the search field, exactly as typing
// would — after the options are in.
await ensureLoaded();
select.setQuery('fra');
});
</script>
<template>
<md-select id="airport" ref="selectRef" label="Airport" filterable loading-text="Searching…"></md-select>
</template><script>
import { onMount } from 'svelte';
import '@awc-ui/core/define';
let selectRef;
onMount(() => {
const select = selectRef;
const load = async (q) => {
select.loading = true;
// await it: loadOptions resolves once the store has finished packing, and
// filtering before that runs against a store that is still loading.
await select.loadOptions(await fetchPage(q)); // your endpoint
select.loading = false;
};
// Fetch the first page when the menu opens, once — loadOptions() replaces the
// whole option set, so a later fetch would overwrite an applied filter.
let loaded = null;
const ensureLoaded = () => (loaded ??= load(''));
select.addEventListener('mdOpen', ensureLoaded);
// …and drive the in-menu search box yourself when you have a query.
// setQuery() filters the menu AND fills the search field, exactly as typing
// would — after the options are in.
await ensureLoaded();
select.setQuery('fra');
});
</script>
<md-select id="airport" bind:this={selectRef} label="Airport" filterable loading-text="Searching…"></md-select>match-trigger-width (on by default) ties the menu to the field’s width; set
match-trigger-width="false" to let the menu size itself. full-width
stretches the trigger to its container, and placement="top-start" opens
upward. Give the menu a sensible max-height so it stays reachable on short
viewports.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Matches the trigger" value="a" max-height="240" style="min-width: 260px;">
<md-select-option value="a">A fairly long option label</md-select-option>
<md-select-option value="b">Short</md-select-option>
</md-select>
<md-select label="Opens upward" value="a" placement="top-start" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Matches the trigger" value="a" maxHeight="240" style={{ minWidth: '260px' }}>
<MdSelectOption value="a">A fairly long option label</MdSelectOption>
<MdSelectOption value="b">Short</MdSelectOption>
</MdSelect>
<MdSelect label="Opens upward" value="a" placement="top-start" style={{ minWidth: '200px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
<MdSelectOption value="b">Option B</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Matches the trigger" value="a" max-height="240" style="min-width: 260px;">
<md-select-option value="a">A fairly long option label</md-select-option>
<md-select-option value="b">Short</md-select-option>
</md-select>
<md-select label="Opens upward" value="a" placement="top-start" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Matches the trigger" value="a" max-height="240" style="min-width: 260px;">
<md-select-option value="a">A fairly long option label</md-select-option>
<md-select-option value="b">Short</md-select-option>
</md-select>
<md-select label="Opens upward" value="a" placement="top-start" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Matches the trigger" value="a" max-height="240" style="min-width: 260px;">
<md-select-option value="a">A fairly long option label</md-select-option>
<md-select-option value="b">Short</md-select-option>
</md-select>
<md-select label="Opens upward" value="a" placement="top-start" style="min-width: 200px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select><!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Density 0" value="a" density="0" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -1" value="a" density="-1" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -2" value="a" density="-2" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -3" value="a" density="-3" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -4" value="a" density="-4" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Density 0" value="a" density="0" style={{ minWidth: '180px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Density -1" value="a" density="-1" style={{ minWidth: '180px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Density -2" value="a" density="-2" style={{ minWidth: '180px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Density -3" value="a" density="-3" style={{ minWidth: '180px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
<MdSelect label="Density -4" value="a" density="-4" style={{ minWidth: '180px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Density 0" value="a" density="0" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -1" value="a" density="-1" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -2" value="a" density="-2" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -3" value="a" density="-3" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -4" value="a" density="-4" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Density 0" value="a" density="0" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -1" value="a" density="-1" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -2" value="a" density="-2" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -3" value="a" density="-3" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -4" value="a" density="-4" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Density 0" value="a" density="0" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -1" value="a" density="-1" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -2" value="a" density="-2" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -3" value="a" density="-3" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>
<md-select label="Density -4" value="a" density="-4" style="min-width: 180px;">
<md-select-option value="a">Option A</md-select-option>
</md-select>virtualize="auto" turns on row virtualization past an internal threshold;
"always" forces it.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select
id="options"
label="Option"
filterable
virtualize="always"
row-height="48"
max-height="320"
></md-select>
<script type="module">
const el = document.getElementById('options');
// A row factory streams into WASM — ten million options never exist as JS
// objects at once. Flip the loading flag around it so the trigger says so.
el.loading = true;
await el.loadOptions({
count: 10_000_000,
getRow: (i) => ({ value: `v${i}`, label: `Option ${i}` }),
});
el.loading = false;
</script>import { useEffect, useRef } from 'react';
import { MdSelect } from '@awc-ui/react';
export function Demo() {
const elRef = useRef(null);
useEffect(() => {
const el = elRef.current;
// A row factory streams into WASM — ten million options never exist as JS
// objects at once. Flip the loading flag around it so the trigger says so.
el.loading = true;
await el.loadOptions({
count: 10_000_000,
getRow: (i) => ({ value: `v${i}`, label: `Option ${i}` }),
});
el.loading = false;
}, []);
return (
<>
<MdSelect
id="options" ref={elRef}
label="Option"
filterable
virtualize="always"
rowHeight="48"
maxHeight="320"
></MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
// app.component.ts
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-demo',
templateUrl: './app.component.html',
})
export class DemoComponent implements AfterViewInit {
@ViewChild('el') elRef!: ElementRef;
ngAfterViewInit() {
const el = this.elRef.nativeElement;
// A row factory streams into WASM — ten million options never exist as JS
// objects at once. Flip the loading flag around it so the trigger says so.
el.loading = true;
await el.loadOptions({
count: 10_000_000,
getRow: (i) => ({ value: `v${i}`, label: `Option ${i}` }),
});
el.loading = false;
}
}
<!-- app.component.html -->
<md-select
id="options" #el
label="Option"
filterable
virtualize="always"
row-height="48"
max-height="320"
></md-select><script setup>
import { onMounted, ref } from 'vue';
import '@awc-ui/core/define';
const elRef = ref(null);
onMounted(() => {
const el = elRef.value;
// A row factory streams into WASM — ten million options never exist as JS
// objects at once. Flip the loading flag around it so the trigger says so.
el.loading = true;
await el.loadOptions({
count: 10_000_000,
getRow: (i) => ({ value: `v${i}`, label: `Option ${i}` }),
});
el.loading = false;
});
</script>
<template>
<md-select
id="options" ref="elRef"
label="Option"
filterable
virtualize="always"
row-height="48"
max-height="320"
></md-select>
</template><script>
import { onMount } from 'svelte';
import '@awc-ui/core/define';
let elRef;
onMount(() => {
const el = elRef;
// A row factory streams into WASM — ten million options never exist as JS
// objects at once. Flip the loading flag around it so the trigger says so.
el.loading = true;
await el.loadOptions({
count: 10_000_000,
getRow: (i) => ({ value: `v${i}`, label: `Option ${i}` }),
});
el.loading = false;
});
</script>
<md-select
id="options" bind:this={elRef}
label="Option"
filterable
virtualize="always"
row-height="48"
max-height="320"
></md-select>md-select is form-associated via ElementInternals, so name puts the
value into FormData across the shadow boundary — no hidden <input> needed.
required participates in native constraint validation, and
value-missing-label supplies the message.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<form id="billing">
<md-select label="Country" name="country" required
value-missing-label="Select a country">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-button variant="filled" type="submit">Save</md-button>
</form>
<script type="module">
const form = document.getElementById('billing');
form.addEventListener('submit', (e) => {
e.preventDefault();
const data = new FormData(e.target);
console.log(Object.fromEntries(data)); // { country: 'fr' }
});
</script>import { MdSelect, MdSelectOption, MdButton } from '@awc-ui/react';
export function BillingForm() {
function onSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
const data = new FormData(e.currentTarget);
console.log(Object.fromEntries(data));
}
return (
<form onSubmit={onSubmit}>
<MdSelect label="Country" name="country" required>
<MdSelectOption value="fr">France</MdSelectOption>
<MdSelectOption value="de">Germany</MdSelectOption>
</MdSelect>
<MdButton variant="filled" type="submit">Save</MdButton>
</form>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-billing-form',
template: `
<form (submit)="onSubmit($event)">
<md-select label="Country" name="country" required>
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-button variant="filled" type="submit">Save</md-button>
</form>
`,
})
export class BillingFormComponent {
onSubmit(e: Event) {
e.preventDefault();
const data = new FormData(e.target as HTMLFormElement);
console.log(Object.fromEntries(data));
}
}<script setup lang="ts">
function onSubmit(e: Event) {
e.preventDefault();
const data = new FormData(e.target as HTMLFormElement);
console.log(Object.fromEntries(data));
}
</script>
<template>
<form @submit="onSubmit">
<md-select label="Country" name="country" required>
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-button variant="filled" type="submit">Save</md-button>
</form>
</template><script lang="ts">
function onSubmit(e: Event) {
e.preventDefault();
const data = new FormData(e.target as HTMLFormElement);
console.log(Object.fromEntries(data));
}
</script>
<form on:submit={onSubmit}>
<md-select label="Country" name="country" required>
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Germany</md-select-option>
</md-select>
<md-button variant="filled" type="submit">Save</md-button>
</form>| Event | Cancelable | Detail | Fires |
|---|---|---|---|
mdChange | no | string | The selected value changed |
mdOpen | no | void | The dropdown opened |
mdClose | no | void | The dropdown closed |
mdValidityChange | no | { valid, validationMessage, flags } | Validity changed |
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select id="priority" label="Priority" value="med" required>
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high">High</md-select-option>
</md-select>
<script type="module">
const sel = document.getElementById('priority');
sel.addEventListener('mdChange', (e) => save(e.detail)); // string
sel.addEventListener('mdValidityChange', (e) => {
console.log(e.detail.valid, e.detail.validationMessage);
});
</script>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function PrioritySelect() {
return (
<MdSelect
label="Priority"
value="med"
required
onMdChange={(e) => save(e.detail)}
onMdValidityChange={(e) => console.log(e.detail.valid)}
>
<MdSelectOption value="low">Low</MdSelectOption>
<MdSelectOption value="med">Medium</MdSelectOption>
<MdSelectOption value="high">High</MdSelectOption>
</MdSelect>
);
}import { Component } from '@angular/core';
@Component({
selector: 'app-priority-select',
template: `
<md-select label="Priority" value="med" required
(mdChange)="onChange($event)"
(mdValidityChange)="onValidity($event)">
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high">High</md-select-option>
</md-select>
`,
})
export class PrioritySelectComponent {
onChange(e: CustomEvent<string>) { save(e.detail); }
onValidity(e: CustomEvent) { console.log(e.detail.valid); }
}<script setup lang="ts">
function onChange(e: CustomEvent<string>) { save(e.detail); }
function onValidity(e: CustomEvent) { console.log(e.detail.valid); }
</script>
<template>
<md-select
label="Priority"
value="med"
required
@mdChange="onChange"
@mdValidityChange="onValidity"
>
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high">High</md-select-option>
</md-select>
</template><script lang="ts">
function onChange(e: CustomEvent<string>) { save(e.detail); }
function onValidity(e: CustomEvent) { console.log(e.detail.valid); }
</script>
<md-select
label="Priority"
value="med"
required
on:mdChange={onChange}
on:mdValidityChange={onValidity}
>
<md-select-option value="low">Low</md-select-option>
<md-select-option value="med">Medium</md-select-option>
<md-select-option value="high">High</md-select-option>
</md-select>| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
valueMissingLabel | value-missing-label | string | 'Please select an item in the list.' | — |
reserveSupportingSpace | reserve-supporting-space | boolean | false | — |
variant | variant | 'filled' | 'outlined' | 'outlined' | Yes |
label | label | string | '' | — |
placeholder | placeholder | string | '' | — |
value | value | string | '' | Yes |
disabled | disabled | boolean | false | Yes |
required | required | boolean | false | Yes |
error | error | boolean | false | Yes |
errorText | error-text | string | '' | — |
supportingText | supporting-text | string | '' | — |
density | density | 0 | -1 | -2 | -3 | -4 | 0 | Yes |
clearable | clearable | boolean | false | Yes |
matchTriggerWidth | match-trigger-width | boolean | true | Yes |
placement | placement | 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom-start' | — |
maxHeight | max-height | number | string | — | — |
options | options | SelectOptionInit[] | string | [] | — |
virtualize | virtualize | 'auto' | 'always' | 'never' | 'auto' | — |
filterable | filterable | boolean | false | — |
filterMode | filter-mode | FilterMode | 'substring' | — |
rowHeight | row-height | number | — | — |
name | name | string | '' | Yes |
searchPlaceholder | search-placeholder | string | 'Search…' | — |
filterLabel | filter-label | string | '' | — |
noResultsText | no-results-text | string | 'No results' | — |
noOptionsText | no-options-text | string | 'No options' | — |
clearLabel | clear-label | string | 'Clear selection' | — |
searchingLabel | searching-label | string | 'Searching' | — |
loadingText | loading-text | string | 'Loading…' | — |
clearIcon | clear-icon | string | 'close' | — |
dropdownIcon | dropdown-icon | string | 'arrow_drop_down' | — |
loading | loading | boolean | false | Yes |
fullWidth | full-width | boolean | false | Yes |
open | open | boolean | false | Yes |
| Method | Parameters |
|---|---|
show() | none |
close() | none |
focusTrigger() | none |
reset() | none |
loadOptions() | source: SelectOptionInit[] | OptionRowSource |
setQuery() | query: string |
getLabels() | values: string[] |
getValidity() | none |
checkValidity() | none |
reportValidity() | none |
setCustomValidity() | message: string |
| Slot | Description |
|---|---|
(default) | — |
loader | — |
dropdown-icon | — |
Override on the host element for per-instance theming:
| Property | Description |
|---|---|
--md-select-width | Host inline size (default 100%) |
--md-select-min-width | Host minimum inline size (default 0) |
--md-select-caret-color | Dropdown caret colour |
--md-select-caret-size | Dropdown caret glyph size (default 24px) |
--md-select-clear-color | Clear (✕) icon colour (default: caret colour) |
--md-select-trailing-gap | Gap between clear + caret (default 2px) |
--md-select-option-icon-color | Leading icon colour in option rows |
--md-select-spinner-size | — |
Style internal elements through shadow DOM with ::part():
| Part | Description |
|---|---|
field | — |
trailing | — |
loading-spinner | — |
clear | — |
caret | — |
option-icon | — |
menu | — |
search-wrap | — |
search | — |
search-spinner | — |
loading-bar | — |
loading-progress | — |
field-container | — |
md-select-optionThe option carrier’s own surface. It renders nothing, so it has no parts or custom properties of its own — theme the select and its menu instead.
| Property | Attribute | Type | Default | Reflects |
|---|---|---|---|---|
value | value | string | '' | — |
label | label | string | '' | — |
disabled | disabled | boolean | false | Yes |
selected | selected | boolean | false | Yes |
icon | icon | string | '' | — |
iconColor | icon-color | string | '' | — |
supportingText | supporting-text | string | '' | — |
| Slot | Description |
|---|---|
(default) | — |
label supplies the accessible name. The dropdown is a md-menu with
managed roving focus; Escape closes and returns focus to the trigger.aria-haspopup rather than a full combobox / aria-activedescendant
wiring. Don’t try to add those from outside — they won’t resolve.reserve-supporting-space on in
dense forms so the layout doesn’t jump.max-height so the menu stays reachable on short viewports.| Key | Action |
|---|---|
Enter / Space / ↓ | Open the menu from the trigger |
↑ / ↓ | Move between options |
Home / End | First / last option |
Enter | Commit the focused option and close |
| A–Z | Typeahead, or types into the search box when filterable |
Escape | Close, returning focus to the trigger |
<!-- 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-select label="Priority" value="med" supporting-text="Arrow to move, Enter to commit" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward">High</md-select-option>
<md-select-option value="crit" disabled>Critical — locked</md-select-option>
</md-select>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Priority" value="med" supportingText="Arrow to move, Enter to commit" style={{ minWidth: '260px' }}>
<MdSelectOption value="low" icon="arrow_downward">Low</MdSelectOption>
<MdSelectOption value="med" icon="remove">Medium</MdSelectOption>
<MdSelectOption value="high" icon="arrow_upward">High</MdSelectOption>
<MdSelectOption value="crit" disabled>Critical — locked</MdSelectOption>
</MdSelect>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Priority" value="med" supporting-text="Arrow to move, Enter to commit" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward">High</md-select-option>
<md-select-option value="crit" disabled>Critical — locked</md-select-option>
</md-select><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Priority" value="med" supporting-text="Arrow to move, Enter to commit" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward">High</md-select-option>
<md-select-option value="crit" disabled>Critical — locked</md-select-option>
</md-select>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-select label="Priority" value="med" supporting-text="Arrow to move, Enter to commit" style="min-width: 260px;">
<md-select-option value="low" icon="arrow_downward">Low</md-select-option>
<md-select-option value="med" icon="remove">Medium</md-select-option>
<md-select-option value="high" icon="arrow_upward">High</md-select-option>
<md-select-option value="crit" disabled>Critical — locked</md-select-option>
</md-select>RTL — field, caret and menu alignment mirror under dir="rtl". placement
is logical (bottom-start follows reading order). See RTL.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<div style="display:flex;gap:24px;flex-wrap:wrap;align-items:flex-start;">
<div dir="ltr"><md-select label="Colour" value="blue" style="min-width: 220px;"><md-select-option value="red">Red</md-select-option><md-select-option value="blue">Blue</md-select-option></md-select></div>
<div dir="rtl"><md-select label="اللون" value="blue" style="min-width: 220px;"><md-select-option value="red">أحمر</md-select-option><md-select-option value="blue">أزرق</md-select-option></md-select></div>
</div>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<div style={{ display: 'flex', gap: '24px', flexWrap: 'wrap', alignItems: 'flex-start' }}>
<div dir="ltr"><MdSelect label="Colour" value="blue" style={{ minWidth: '220px' }}><MdSelectOption value="red">Red</MdSelectOption><MdSelectOption value="blue">Blue</MdSelectOption></MdSelect></div>
<div dir="rtl"><MdSelect label="اللون" value="blue" style={{ minWidth: '220px' }}><MdSelectOption value="red">أحمر</MdSelectOption><MdSelectOption value="blue">أزرق</MdSelectOption></MdSelect></div>
</div>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<div style="display:flex;gap:24px;flex-wrap:wrap;align-items:flex-start;">
<div dir="ltr"><md-select label="Colour" value="blue" style="min-width: 220px;"><md-select-option value="red">Red</md-select-option><md-select-option value="blue">Blue</md-select-option></md-select></div>
<div dir="rtl"><md-select label="اللون" value="blue" style="min-width: 220px;"><md-select-option value="red">أحمر</md-select-option><md-select-option value="blue">أزرق</md-select-option></md-select></div>
</div><script setup>
import '@awc-ui/core/define';
</script>
<template>
<div style="display:flex;gap:24px;flex-wrap:wrap;align-items:flex-start;">
<div dir="ltr"><md-select label="Colour" value="blue" style="min-width: 220px;"><md-select-option value="red">Red</md-select-option><md-select-option value="blue">Blue</md-select-option></md-select></div>
<div dir="rtl"><md-select label="اللون" value="blue" style="min-width: 220px;"><md-select-option value="red">أحمر</md-select-option><md-select-option value="blue">أزرق</md-select-option></md-select></div>
</div>
</template><script>
import '@awc-ui/core/define';
</script>
<div style="display:flex;gap:24px;flex-wrap:wrap;align-items:flex-start;">
<div dir="ltr"><md-select label="Colour" value="blue" style="min-width: 220px;"><md-select-option value="red">Red</md-select-option><md-select-option value="blue">Blue</md-select-option></md-select></div>
<div dir="rtl"><md-select label="اللون" value="blue" style="min-width: 220px;"><md-select-option value="red">أحمر</md-select-option><md-select-option value="blue">أزرق</md-select-option></md-select></div>
</div>Density — density="-1…-4" compacts the trigger and the menu rows. See
Density.
i18n — every user-facing string is a prop and all of them default to
English: search-placeholder, filter-label, no-results-text,
no-options-text, clear-label, searching-label, loading-text,
value-missing-label, plus label, placeholder, supporting-text and
error-text. Option labels come from your data or slotted text; keep value
an untranslated identifier.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Pays" filterable clearable value="fr"
search-placeholder="Rechercher…" no-results-text="Aucun résultat"
no-options-text="Aucune option" clear-label="Effacer la sélection"
style="min-width: 260px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Allemagne</md-select-option>
<md-select-option value="es">Espagne</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Pays" filterable clearable value="fr"
searchPlaceholder="Rechercher…" noResultsText="Aucun résultat"
noOptionsText="Aucune option" clearLabel="Effacer la sélection"
style={{ minWidth: '260px' }}>
<MdSelectOption value="fr">France</MdSelectOption>
<MdSelectOption value="de">Allemagne</MdSelectOption>
<MdSelectOption value="es">Espagne</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Pays" filterable clearable value="fr"
search-placeholder="Rechercher…" no-results-text="Aucun résultat"
no-options-text="Aucune option" clear-label="Effacer la sélection"
style="min-width: 260px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Allemagne</md-select-option>
<md-select-option value="es">Espagne</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Pays" filterable clearable value="fr"
search-placeholder="Rechercher…" no-results-text="Aucun résultat"
no-options-text="Aucune option" clear-label="Effacer la sélection"
style="min-width: 260px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Allemagne</md-select-option>
<md-select-option value="es">Espagne</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Pays" filterable clearable value="fr"
search-placeholder="Rechercher…" no-results-text="Aucun résultat"
no-options-text="Aucune option" clear-label="Effacer la sélection"
style="min-width: 260px;">
<md-select-option value="fr">France</md-select-option>
<md-select-option value="de">Allemagne</md-select-option>
<md-select-option value="es">Espagne</md-select-option>
</md-select>| Custom property | Purpose |
|---|---|
--md-select-width / --md-select-min-width | Trigger width |
--md-select-caret-color / --md-select-caret-size | Dropdown caret |
--md-select-clear-color | Clear affordance |
--md-select-trailing-gap | Spacing of trailing controls |
--md-select-option-icon-color | Option row icons |
--md-select-spinner-size | Loading spinner |
The embedded field and menu also honour the --md-text-field-*, --md-menu-*
and --md-menu-item-* properties.
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<md-select label="Themed" value="a" clearable style="--md-select-min-width: 260px; --md-select-caret-color: var(--md-sys-color-primary); --md-text-field-container-shape: 4px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Themed" value="a" clearable style={{ '--md-select-min-width': '260px', '--md-select-caret-color': 'var(--md-sys-color-primary)', '--md-text-field-container-shape': '4px' }}>
<MdSelectOption value="a">Option A</MdSelectOption>
<MdSelectOption value="b">Option B</MdSelectOption>
</MdSelect>
</>
);
}// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Themed" value="a" clearable style="--md-select-min-width: 260px; --md-select-caret-color: var(--md-sys-color-primary); --md-text-field-container-shape: 4px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select><script setup>
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Themed" value="a" clearable style="--md-select-min-width: 260px; --md-select-caret-color: var(--md-sys-color-primary); --md-text-field-container-shape: 4px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>
</template><script>
import '@awc-ui/core/define';
</script>
<md-select label="Themed" value="a" clearable style="--md-select-min-width: 260px; --md-select-caret-color: var(--md-sys-color-primary); --md-text-field-container-shape: 4px;">
<md-select-option value="a">Option A</md-select-option>
<md-select-option value="b">Option B</md-select-option>
</md-select>Every default resolves through an md-sys-color role, so a select that sets no
custom properties follows the theme on its own:
<!-- 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-select label="Untouched defaults" value="b" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite" supporting-text="With supporting text">Option B</md-select-option>
</md-select>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<MdSelect label="Untouched defaults" value="b" clearable style={{ minWidth: '260px' }}>
<MdSelectOption value="a" icon="star">Option A</MdSelectOption>
<MdSelectOption value="b" icon="favorite" supportingText="With supporting text">Option B</MdSelectOption>
</MdSelect>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<md-select label="Untouched defaults" value="b" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite" supporting-text="With supporting text">Option B</md-select-option>
</md-select><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<md-select label="Untouched defaults" value="b" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite" supporting-text="With supporting text">Option B</md-select-option>
</md-select>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<md-select label="Untouched defaults" value="b" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite" supporting-text="With supporting text">Option B</md-select-option>
</md-select>| Part | Element |
|---|---|
field | The text-field trigger |
trailing / caret / clear | Trailing region, dropdown caret, clear affordance |
menu | The dropdown surface |
search / search-wrap / search-spinner | In-menu filter field and its busy state |
option-icon | Per-option icon |
loading-spinner / loading-bar / loading-progress | Async loading affordances |
<!-- index.html <head> — the icon font the components draw from -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap">
<!-- index.html — register the AWC UI elements once -->
<script type="module">
import '@awc-ui/core/define';
</script>
<style>
.parts-select::part(caret) { color: var(--md-sys-color-primary); }
.parts-select::part(field) { --md-text-field-container-shape: 4px; }
</style>
<md-select class="parts-select" label="Styled parts" value="a" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite">Option B</md-select-option>
</md-select>// Icons need the Material Symbols stylesheet in index.html — see Installation.
import { MdSelect, MdSelectOption } from '@awc-ui/react';
export function Demo() {
return (
<>
<style>
.parts-select::part(caret) { color: var(--md-sys-color-primary); }
.parts-select::part(field) { --md-text-field-container-shape: 4px; }
</style>
<MdSelect className="parts-select" label="Styled parts" value="a" clearable style={{ minWidth: '260px' }}>
<MdSelectOption value="a" icon="star">Option A</MdSelectOption>
<MdSelectOption value="b" icon="favorite">Option B</MdSelectOption>
</MdSelect>
</>
);
}// Icons need the Material Symbols stylesheet in index.html — see Installation.
// app.module.ts — register the AWC UI elements once
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AwcUiModule } from '@awc-ui/angular';
@NgModule({
imports: [AwcUiModule],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- app.component.html -->
<style>
.parts-select::part(caret) { color: var(--md-sys-color-primary); }
.parts-select::part(field) { --md-text-field-container-shape: 4px; }
</style>
<md-select class="parts-select" label="Styled parts" value="a" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite">Option B</md-select-option>
</md-select><script setup>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<template>
<style>
.parts-select::part(caret) { color: var(--md-sys-color-primary); }
.parts-select::part(field) { --md-text-field-container-shape: 4px; }
</style>
<md-select class="parts-select" label="Styled parts" value="a" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite">Option B</md-select-option>
</md-select>
</template><script>
// Icons need the Material Symbols stylesheet in index.html — see Installation.
import '@awc-ui/core/define';
</script>
<style>
.parts-select::part(caret) { color: var(--md-sys-color-primary); }
.parts-select::part(field) { --md-text-field-container-shape: 4px; }
</style>
<md-select class="parts-select" label="Styled parts" value="a" clearable style="min-width: 260px;">
<md-select-option value="a" icon="star">Option A</md-select-option>
<md-select-option value="b" icon="favorite">Option B</md-select-option>
</md-select>md-select-option ·
md-multi-select ·
md-autocomplete ·
md-menu ·
md-menu-item ·
md-radio ·
md-text-field ·
md-segmented-button
md-selectTwo artefacts to give your AI agent so it generates correct UI with this component. The per-component spec answers "how do I use this exact tag?". The main-llm spec answers "which tag should I pick in the first place?".
md-select spec card
Identity · when to use / when NOT · decision cues · behavioural contract · do/don't · anti-patterns · full API. Paste into your agent when you're implementing with this component.
System-prompt preamble · decision matrix · token reference · page recipes · anti-patterns. Paste into the system prompt at the start of a piece of work.