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

<mth-currency-input>

@methane-ui/ui~11.2 KB brotli (cold + Lit)~3.8 KB marginal

Form-associated locale-aware monetary input backed by Intl.NumberFormat, FormattingUtils, and MaskAndFormatEngine numeric grouping.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/currency-input"></script>
<mth-currency-input currency="USD" decimals="2"></mth-currency-input>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Canonical unmasked numeric string (e.g. "1234.56").
namenamestring""Form submission field name.
labellabelstring""Accessible label rendered inside shadow root.
hinthintstring""Helper text displayed below control.
errorerrorstring""Explicit custom error message.
placeholderplaceholderstring""Placeholder shown when empty.
currencycurrencystring"USD"ISO-4217 3-letter currency code (e.g. "USD", "EUR", "JPY").
localelocalestring""BCP-47 locale identifier used for separators and currency symbol.
decimalsdecimalsnumber2Maximum fractional decimal digits allowed.
allowNegativeallow-negativebooleanfalseAllows leading minus sign.
minminnumber | undefined—Minimum valid monetary amount.
maxmaxnumber | undefined—Maximum valid monetary amount.
disableddisabledbooleanfalseDisables user interaction.
requiredrequiredbooleanfalseMarks field required.
readonlyreadonlybooleanfalsePrevents edits while allowing focus and submission.

Events

EventDetail TypeDescription
mth-input{ value: string; valueAsNumber: number; currency: string }Fired synchronously when the monetary amount changes.
mth-change{ value: string; valueAsNumber: number; currency: string }Fired when the edited monetary amount commits.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
Enterbothinside a form and not composing IMErequests submission of owning form

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