Skip to Content

PaymentMethodSelector

Render provider-neutral payment method choices with accessible radio-group behavior.

PaymentMethodSelector presents caller-supplied payment methods without depending on a payment provider. Each option can include a label, description, provider name, icon, disabled state, and a stable identifier.

Stable API maturity: Stable. The component API is covered by package tests and is intended to remain backward-compatible within a major version.

390 × 844

Installation

import {
  PaymentMethodSelector,
  type PaymentMethodOption,
} from "@puzzle-ui/pieces";

API

PropTypeDescription
methodsreadonly PaymentMethodOption[]Required options with unique, non-empty IDs.
valuestringControlled selected method.
defaultValuestringInitial selected method for uncontrolled usage.
namestringNative radio-group name.
labelReactNodeVisible group label; defaults to "Payment method".
descriptionReactNodeSupporting group description.
errorReactNodeValidation feedback.
requiredbooleanMarks the group as required.
disabledbooleanDisables all methods.
onValueChange(value: string) => voidCalled after a method is selected.
PropRequiredDefault
methodsYes—
labelNo"Payment method"
disabledNofalse

The component validates option identifiers and delegates keyboard navigation, focus behavior, and native radio semantics to @puzzle-ui/ui.

Responsive behavior

Options wrap their labels and provider metadata naturally. Use the selector inside the checkout layout at mobile, tablet, and desktop widths; keep application-provided icons and descriptions compact enough to avoid overflow.

Theme support

The selector delegates control styling to @puzzle-ui/ui and consumes the active Puzzle Theme tokens, including text, surface, border, and focus colors.

Customization and composition

Use the icon, provider, description, and disabled fields to adapt each option, or compose the selector inside CheckoutSection. The component does not select a provider, fetch availability, or submit a payment.

TypeScript example

import type { ComponentProps } from "react";
import { PaymentMethodSelector } from "@puzzle-ui/pieces";

type SelectorProps = ComponentProps<typeof PaymentMethodSelector>;

export const BrandedPaymentMethods = (props: SelectorProps) => (
  <PaymentMethodSelector {...props} />
);

Framework integration

The selector is router-independent and can be rendered inside any React application. See Pieces framework integration for SSR and client-boundary guidance.

Provider independence

Use server-derived availability to determine which methods are shown. Do not infer provider support from client input, and do not expose provider secrets in option metadata or labels.