← All Components
<mth-price-display>
Locale-aware currency price formatter supporting compare-at pricing, discount badges, and billing cadence.
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-price-display>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/commerce/price-display"></script>
<mth-price-display amount="0" compare-at-amount="null"></mth-price-display>import '@methane-ui/commerce/price-display';
import '@methane-ui/react';
export function Example() {
return <mth-price-display amount="0" compare-at-amount="null"></mth-price-display>;
}<script setup lang="ts">
import '@methane-ui/commerce/price-display';
</script>
<template>
<mth-price-display amount="0" compare-at-amount="null"></mth-price-display>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/commerce/price-display';
import { MthPriceDisplayDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthPriceDisplayDirective],
template: `<mth-price-display amount="0" compare-at-amount="null"></mth-price-display>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/commerce/price-display';
import MthPriceDisplay from '@methane-ui/svelte/MthPriceDisplay.svelte';
</script>
<MthPriceDisplay amount="0" compare-at-amount="null"></MthPriceDisplay>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
amount | amount | number | 0 | Numeric monetary amount. |
compareAtAmount | compare-at-amount | number | null | null | Optional original price shown struck through when higher than amount. |
currency | currency | string | "USD" | ISO 4217 currency code passed to Intl.NumberFormat. |
locale | locale | string | "" | Optional BCP 47 locale override; defaults to UIElement resolvedLocale. |
period | period | string | "" | Optional recurring billing period suffix (e.g., /mo). |
showDiscountBadge | show-discount-badge | boolean | true | Displays percentage savings badge when compareAtAmount exceeds amount. |
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 |
| states | Exposes ElementInternals CustomStateSet flags: :state(on-sale), :state(free). | Conformance suite |
| i18n | Routes 3 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |