← All Components
<mth-payment-form>
Form-associated payment card entry form using MaskAndFormatEngine + Luhn validation, proper cc-* autocomplete hints, and non-PAN submission detail.
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-payment-form>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/commerce/payment-form"></script>
<mth-payment-form amount="0" currency="USD"></mth-payment-form>import '@methane-ui/commerce/payment-form';
import '@methane-ui/react';
export function Example() {
return <mth-payment-form amount="0" currency="USD"></mth-payment-form>;
}<script setup lang="ts">
import '@methane-ui/commerce/payment-form';
</script>
<template>
<mth-payment-form amount="0" currency="USD"></mth-payment-form>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/commerce/payment-form';
import { MthPaymentFormDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthPaymentFormDirective],
template: `<mth-payment-form amount="0" currency="USD"></mth-payment-form>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/commerce/payment-form';
import MthPaymentForm from '@methane-ui/svelte/MthPaymentForm.svelte';
</script>
<MthPaymentForm amount="0" currency="USD"></MthPaymentForm>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Form-associated cardholder name value submitted in FormData. |
name | name | string | "" | Form field name submitted via FormData. |
amount | amount | number | 0 | Optional order total formatted onto the submit CTA. |
currency | currency | string | "USD" | ISO 4217 currency code passed to Intl.NumberFormat. |
locale | locale | string | "" | Optional BCP 47 locale override; defaults to UIElement resolvedLocale. |
submitLabel | submit-label | string | "" | Overrides localized submit button label. |
disabled | disabled | boolean | false | Disables all payment inputs and submit action. |
required | required | boolean | false | Enforces required cardholder constraint validation. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { cardholderName: string; last4: string; valid: boolean } | Emitted event mth-change. |
mth-submit | { cardholderName: string; last4: string; expiry: string; valid: boolean } | Emitted event mth-submit. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| Enter | both | input focused | Validate and submit payment form. |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | 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-payment-form.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(disabled), :state(invalid). | Conformance suite |
| i18n | Routes 10 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |