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

<mth-product-card>

@methane-ui/commerce~6.8 KB brotli (kit + Lit)~1.4 KB marginal

E-commerce product card with sanitized media/link URLs, locale-aware currency pricing, accessible rating summary, and quick-add action.

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-product-card> (@methane-ui/commerce)
Studio Mechanical Keyboard illustration
Ready · interact with <mth-product-card>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/commerce/product-card"></script>
<mth-product-card price="null" compare-at-price="null"></mth-product-card>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
titletitlestring""Product display title.
subtitlesubtitlestring""Optional secondary product descriptor.
imageSrcimage-srcstring""Product image URL validated via @methane-ui/sanitize isSafeUrl.
imageAltimage-altstring""Alternative text for product image.
hrefhrefstring""Optional product detail link validated via isSafeUrl.
pricepricenumber | nullnullCurrent unit price in currency.
compareAtPricecompare-at-pricenumber | nullnullOptional original strikethrough price.
currencycurrencystring"USD"ISO 4217 currency code.
localelocalestring""Optional BCP 47 locale override for Intl.NumberFormat.
badgebadgestring""Optional promotional badge text.
ratingratingnumber | nullnullOptional numeric star rating (0–5).
reviewCountreview-countnumber | nullnullOptional total review count shown alongside rating.
inStockin-stockbooleantrueWhether the product is purchasable.
actionLabelaction-labelstring""Custom CTA label overriding localized Add to cart text.

Events

EventDetail TypeDescription
mth-add-to-cart{ title: string; price: number | null; currency: string }Fired when the user clicks the Add to cart button.
mth-product-select{ title: string; href: string }Fired when the user activates the product link/title.

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
statesExposes ElementInternals CustomStateSet flags: :state(out-of-stock), :state(on-sale).Conformance suite
i18nRoutes 5 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test