Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-creatable-select>

@methane-ui/ui~12.3 KB brotli (cold + Lit)~4.4 KB marginal

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

Interactive StageLive Custom Element · <mth-creatable-select> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""Form field name.
valuevaluestring""Selected value (or comma-separated values in multiple mode).
defaultValuedefault-valuestring""Initial value restored on form reset.
options—ReadonlyArray<unknown> | nullnullList of options.
multiplemultiplebooleanfalseAllows selecting and creating multiple values.
allowCreateallow-createbooleantrueEnables creating non-matching query strings as new options.
labellabelstring""Accessible field label.
placeholderplaceholderstring""Input placeholder.
hinthintstring""Helper message.
errorerrorstring""Validation error message.
openopenbooleanfalseControls dropdown visibility.
disableddisabledbooleanfalseDisables interaction.
requiredrequiredbooleanfalseRequires a selection.

Events

EventDetail TypeDescription
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-openundefinedFired before opening overlay.
mth-after-openundefinedFired after opening overlay.
mth-closeundefinedFired before closing overlay.
mth-after-closeundefinedFired after closing overlay.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowDown / ArrowUpbothlistbox opennavigates options including create row
Enterbothtyped non-matching querycreates new option and selects it
Escapebothlistbox opencloses listbox and restores focus

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 3 APG keyboard transitions across LTR/RTL.mth-creatable-select.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test