← All Components
<mth-select>
Form-associated select control with progressive customizable appearance: base-select detection and popover listbox fallback.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-select>, or toggle Theme, Direction (LTR/RTL), or props above.
Live Variants & States Showcase
default + placeholderNode.js 22 Deno 2 Bun 1.2
clearable + selectedAstro Next.js Nuxt
error & disabledUS East Locked Plan
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/select"></script>
<mth-select placement="bottom-start">Example</mth-select>import '@methane-ui/ui/select';
import '@methane-ui/react';
export function Example() {
return <mth-select placement="bottom-start">Example</mth-select>;
}<script setup lang="ts">
import '@methane-ui/ui/select';
</script>
<template>
<mth-select placement="bottom-start">Example</mth-select>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/select';
import { MthSelectDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthSelectDirective],
template: `<mth-select placement="bottom-start">Example</mth-select>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/select';
import MthSelect from '@methane-ui/svelte/MthSelect.svelte';
</script>
<MthSelect placement="bottom-start">Example</MthSelect>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
name | name | string | "" | Form field name submitted via FormData. |
value | value | string | "" | Selected option value (comma-separated when multiple). |
defaultValue | default-value | string | "" | Initial value used on form reset. |
label | label | string | "" | Visible label text for the select. |
hint | hint | string | "" | Supplementary helper text below the control. |
error | error | string | "" | Validation error message. |
placeholder | placeholder | string | "" | Placeholder shown when no option is selected. |
open | open | boolean | false | Whether the fallback options popup is currently open. |
multiple | multiple | boolean | false | Allows selecting multiple options. |
disabled | disabled | boolean | false | Disables user interaction and form submission. |
required | required | boolean | false | Marks selection as required for constraint validation. |
readonly | readonly | boolean | false | Prevents changing the selection while keeping it focusable. |
clearable | clearable | boolean | false | Renders a clear button when a selection is present. |
placement | placement | string | "bottom-start" | Preferred popup placement relative to the trigger. |
forceFallback | force-fallback | boolean | false | Forces the popover + positioned shadow listbox path even when base-select is supported. |
options | — | ReadonlyArray<{ readonly id?: string; readonly value: string; readonly label: string; readonly disabled?: boolean; readonly group?: string }> | null | null | Programmatic array of options. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { value: string; selectedValues: ReadonlyArray<string> } | Fired when the selected value(s) change. |
mth-open | void | Cancelable event fired before opening the popup. |
mth-after-open | void | Fired after the popup opens. |
mth-close | { reason: string } | Cancelable event fired before closing the popup. |
mth-after-close | { reason: string } | Fired after the popup closes. |
mth-clear | void | Fired when the selection is cleared. |
mth-invalid | { validity: ValidityState } | Fired when constraint validation fails. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | closed | opens listbox popup and highlights selected or first enabled option |
| Space | both | closed | opens listbox popup and highlights selected or first enabled option |
| ArrowDown | both | closed | opens listbox popup and moves active highlight to first enabled option |
| ArrowDown | both | open | moves active option to next enabled option |
| ArrowUp | both | open | moves active option to previous enabled option |
| Home | both | open | moves active option to first enabled option |
| End | both | open | moves active option to last enabled option |
| Enter | both | open | selects active option and closes popup in single mode |
| Escape | both | open | closes popup and restores focus to trigger |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 9 APG keyboard transitions across LTR/RTL. | mth-select.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(readonly), :state(required), :state(invalid). | Conformance suite |
| i18n | Routes 6 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |