PaymentMethodList
- Status
- Implemented
- Family
- 3 of 13
- Registry
- @lopifi/payment-method-list
npx shadcn@latest add @lopifi/theme @lopifi/payment-method-listThe component, rendering
Real data, the shipped component. Switch the theme to check the claims the spec makes below.
The four-layer spec
Radio cards with EntityMark, masked number, and any per-method fee/timing difference stated inline. Selected state: 2px --accent border and an --accent-subtle background — and a check glyph, because border color alone fails forced-colors mode.
Lifted verbatim from Payments. The doc and this page are the same paragraphs, so they cannot disagree.
What lands in your repository
One component is never one file. Everything below is copied into your project, where you own it.
- Files
components/ledger/payment-method-list.tsx
- Lopifi dependencies · 8
- cnentity-markformat-moneyiconsmoneymoney.typesreferencetooltip
- npm packages
- @base-ui-components/reactclass-variance-authorityclsxtailwind-merge
- Registry entry
- /r/payment-method-list.json
The whole component
No compiled bundle, no black box. This is the file the registry copies, and the file you will edit.
"use client";
import { Radio } from "@base-ui-components/react/radio";
import { RadioGroup } from "@base-ui-components/react/radio-group";
import { cn } from "@/lib/ledger/cn";
import type { MoneyValue } from "@/lib/ledger/money.types";
import { EntityMark } from "@/components/ledger/entity-mark";
import { CheckIcon } from "@/components/ledger/icons";
import { Money } from "@/components/ledger/money";
import { MaskedAccount } from "@/components/ledger/reference";
export type PaymentMethod = {
id: string;
name: string;
last4: string;
kind: "bank" | "card";
/** Stated inline; per-method differences are the reason this list exists. */
fee?: MoneyValue;
arrival: string;
};
export interface PaymentMethodListProps {
className?: string;
methods: PaymentMethod[];
onValueChange: (id: string) => void;
value: string;
}
/**
* Selected state carries a 2px accent border, an accent-subtle background,
*and* a check glyph — border colour alone fails forced-colors mode.
*/
export function PaymentMethodList({ methods, value, onValueChange, className }: PaymentMethodListProps) {
return (
<RadioGroup
aria-label="Payment method"
className={cn("flex flex-col gap-2", className)}
onValueChange={(v) => onValueChange(String(v))}
value={value}
>
{methods.map((m) => {
const selected = m.id === value;
return (
<Radio.Root
className={cn(
"flex items-center gap-3 rounded-md border bg-surface p-3 text-left",
"transition-colors duration-1 ease-standard",
selected
? "border-2 border-accent bg-accent-subtle p-[11px]"
: "border-border hover:bg-surface-hover",
)}
key={m.id}
value={m.id}
>
<EntityMark category={m.kind} name={m.name} size={32} />
<span className="min-w-0 flex-1">
<span className="block truncate text-body font-medium">{m.name}</span>
<span className="flex items-center gap-2 text-caption text-text-secondary">
<MaskedAccount last4={m.last4} />
<span aria-hidden="true">·</span>
{m.arrival}
</span>
</span>
{m.fee ? (
<span className="text-caption text-text-secondary">
Fee <Money size="xs" tone="inherit" value={m.fee} />
</span>
) : (
<span className="text-caption text-text-secondary">No fee</span>
)}
<span
aria-hidden="true"
className={cn(
"grid size-5 shrink-0 place-items-center rounded-full border",
selected ? "border-accent bg-accent text-accent-fg" : "border-border-strong",
)}
>
{selected ? <CheckIcon className="size-3" /> : null}
</span>
</Radio.Root>
);
})}
</RadioGroup>
);
}
Also in Payments
- AmountInputThe hardest input in fintech.
- CurrencySelectSearchable, with recents.
- PayeeSelectRecipient picker with fuzzy search and last-paid.
- PaymentFormAmount → payee → method → date → memo.
- CheckoutSummaryItemized total with fees and tax.
- ConfirmPaymentDialogAmount, destination, timing. Hold-to-confirm.
- PaymentStatusTimelineSubmitted → sent → settled, with real timestamps.
- PaymentSuccessThe sanctioned delight moment.
- ReceiptSheetPrintable/shareable receipt.
- PayoutScheduleUpcoming payouts calendar.
- CardInputPAN / expiry / CVC with correct autocomplete.
- BankAccountInputRouting + account with checksum validation.
- RecurringScheduleFrequency, end condition, preview of next 3.
See also
A component is specified in one place, defined in another, and running in a third. All three, from here.
Elsewhere in the system
Where PaymentMethodList sits in the rest of the system — the live section it renders in, the calculators that compute what it displays, and the ledger payloads it is fed from.
Components are copied into your repository and meant to be edited — rounding policy, fiscal calendar and compliance copy differ per company.
Told when Payments changes
Components are copied into your repo, so a fix here does not reach you on its own. One email when a component in this family changes in a way that needs a migration — and nothing when it does not.