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

<mth-tag-input>

@methane-ui/ui~10.1 KB brotli (cold + Lit)~3.2 KB marginal

Form-associated inline tag chip editor supporting delimiter splitting, paste parsing, Backspace deletion, duplicate guards, and max-tags limits.

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-tag-input> (@methane-ui/ui)
Ready · interact with <mth-tag-input>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/tag-input"></script>
<mth-tag-input max-tags="0" delimiter=","></mth-tag-input>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
namenamestring""Form field name.
valuevaluestring""Comma-separated string of entered tags.
defaultValuedefault-valuestring""Initial comma-separated tag value for form reset.
maxTagsmax-tagsnumber0Maximum number of tags allowed (0 for unlimited).
allowDuplicatesallow-duplicatesbooleanfalseAllows duplicate tag values.
delimiterdelimiterstring","delimiter property.
labellabelstring""Accessible field label.
placeholderplaceholderstring""Input placeholder text.
hinthintstring""Helper message.
errorerrorstring""Validation error message.
disableddisabledbooleanfalseDisables editing and removal.
readonlyreadonlybooleanfalsePrevents adding or removing tags.
requiredrequiredbooleanfalseRequires at least one tag for validity.

Events

EventDetail TypeDescription
mth-change{ value: string; values: ReadonlyArray<string> }Fired when the tag list changes.
mth-tag-add{ tag: string; values: ReadonlyArray<string> }Fired when a tag is added.
mth-tag-remove{ tag: string; index: number; values: ReadonlyArray<string> }Fired when a tag is removed.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Enterbothinput has textcommits new tag chip and clears input
Backspacebothinput empty and tags presentremoves last tag chip

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 2 APG keyboard transitions across LTR/RTL.mth-tag-input.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required).Conformance suite
i18nRoutes 4 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test