← All Components
<mth-currency-input>
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
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>import '@methane-ui/ui/currency-input';
import '@methane-ui/react';
export function Example() {
return <mth-currency-input currency="USD" decimals="2"></mth-currency-input>;
}<script setup lang="ts">
import '@methane-ui/ui/currency-input';
</script>
<template>
<mth-currency-input currency="USD" decimals="2"></mth-currency-input>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/currency-input';
import { MthCurrencyInputDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthCurrencyInputDirective],
template: `<mth-currency-input currency="USD" decimals="2"></mth-currency-input>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/currency-input';
import MthCurrencyInput from '@methane-ui/svelte/MthCurrencyInput.svelte';
</script>
<MthCurrencyInput currency="USD" decimals="2"></MthCurrencyInput>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Canonical unmasked numeric string (e.g. "1234.56"). |
name | name | string | "" | Form submission field name. |
label | label | string | "" | Accessible label rendered inside shadow root. |
hint | hint | string | "" | Helper text displayed below control. |
error | error | string | "" | Explicit custom error message. |
placeholder | placeholder | string | "" | Placeholder shown when empty. |
currency | currency | string | "USD" | ISO-4217 3-letter currency code (e.g. "USD", "EUR", "JPY"). |
locale | locale | string | "" | BCP-47 locale identifier used for separators and currency symbol. |
decimals | decimals | number | 2 | Maximum fractional decimal digits allowed. |
allowNegative | allow-negative | boolean | false | Allows leading minus sign. |
min | min | number | undefined | — | Minimum valid monetary amount. |
max | max | number | undefined | — | Maximum valid monetary amount. |
disabled | disabled | boolean | false | Disables user interaction. |
required | required | boolean | false | Marks field required. |
readonly | readonly | boolean | false | Prevents edits while allowing focus and submission. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | inside a form and not composing IME | requests submission of owning form |
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 1 APG keyboard transitions across LTR/RTL. | mth-currency-input.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(dirty), :state(touched), :state(user-invalid), :state(disabled), :state(required), :state(readonly). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |