← All Components
<mth-creatable-select>
Form-associated searchable select/combobox supporting on-the-fly option creation (mth-create) in single or multiple mode.
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-creatable-select>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/creatable-select"></script>
<mth-creatable-select allow-create></mth-creatable-select>import '@methane-ui/ui/creatable-select';
import '@methane-ui/react';
export function Example() {
return <mth-creatable-select allow-create></mth-creatable-select>;
}<script setup lang="ts">
import '@methane-ui/ui/creatable-select';
</script>
<template>
<mth-creatable-select allow-create></mth-creatable-select>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/creatable-select';
import { MthCreatableSelectDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCreatableSelectDirective],
template: `<mth-creatable-select allow-create></mth-creatable-select>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/creatable-select';
import MthCreatableSelect from '@methane-ui/svelte/MthCreatableSelect.svelte';
</script>
<MthCreatableSelect allow-create></MthCreatableSelect>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
name | name | string | "" | Form field name. |
value | value | string | "" | Selected value (or comma-separated values in multiple mode). |
defaultValue | default-value | string | "" | Initial value restored on form reset. |
options | — | ReadonlyArray<unknown> | null | null | List of options. |
multiple | multiple | boolean | false | Allows selecting and creating multiple values. |
allowCreate | allow-create | boolean | true | Enables creating non-matching query strings as new options. |
label | label | string | "" | Accessible field label. |
placeholder | placeholder | string | "" | Input placeholder. |
hint | hint | string | "" | Helper message. |
error | error | string | "" | Validation error message. |
open | open | boolean | false | Controls dropdown visibility. |
disabled | disabled | boolean | false | Disables interaction. |
required | required | boolean | false | Requires a selection. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { value: string; values: ReadonlyArray<string> } | Fired when selection changes. |
mth-create | { value: string; label: string } | Fired when the user creates a new option from typed text. |
mth-open | undefined | Fired before opening overlay. |
mth-after-open | undefined | Fired after opening overlay. |
mth-close | undefined | Fired before closing overlay. |
mth-after-close | undefined | Fired after closing overlay. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowDown / ArrowUp | both | listbox open | navigates options including create row |
| Enter | both | typed non-matching query | creates new option and selects it |
| Escape | both | listbox open | closes listbox and restores focus |
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 3 APG keyboard transitions across LTR/RTL. | mth-creatable-select.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required). | Conformance suite |
| i18n | Routes 7 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |