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

<mth-cart>

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

Accessible shopping cart line-item list with quantity adjustments, item removal, URL sanitization, and localized currency breakdown.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/commerce/cart"></script>
<mth-cart currency="USD" tax-rate="0"></mth-cart>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
items—ReadonlyArray<unknown>—Array of CartItem entries in the cart.
currencycurrencystring"USD"ISO 4217 currency code used by Intl.NumberFormat.
localelocalestring""Optional BCP 47 locale override; defaults to UIElement resolvedLocale.
taxRatetax-ratenumber0Fractional tax rate applied to discounted subtotal (e.g., 0.08).
shippingAmountshipping-amountnumber0Flat shipping amount added to total.
discountAmountdiscount-amountnumber0Flat discount subtracted from subtotal before tax.
allowRemoveallow-removebooleantrueShows item removal controls when true.
disableddisabledbooleanfalseDisables interactive quantity, remove, and checkout actions.
checkoutLabelcheckout-labelstring""Overrides localized checkout CTA label.

Events

EventDetail TypeDescription
mth-quantity-change{ id: string; quantity: number }Emitted event mth-quantity-change.
mth-remove-item{ id: string }Emitted event mth-remove-item.
mth-checkout{ items: ReadonlyArray<unknown>; subtotal: number; total: number }Emitted event mth-checkout.

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".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(empty), :state(disabled).Conformance suite
i18nRoutes 13 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test