Payment methods radio accordion — Storefront block

Pro

storefront-payment-methods-radio-accordion · for checkout pages

Payment methods radio accordion

Several unlike methods (card, PayPal, transfer): each a row that opens only its own fields

Documentation

Installation

One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).

pnpm dlx shadcn-vue@latest add @trame/storefront-payment-methods-radio-accordion

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontPaymentMethodsRadioAccordion from '@/components/trame/blocks/storefront/storefront-payment-methods-radio-accordion.vue'

const props = {
title: "Payment",
intro: "Choose how to pay for your order.",
total: 25930,
methods: [
{
id: "apple-pay",
label: "Apple Pay",
kind: "wallet"
},
{
id: "paypal-express",
label: "PayPal",
kind: "wallet"
}
],
action: {
label: "Pay",
action: "place-order"
},
walletAction: "wallet-pay",
reassurance: "Your card is charged when your order ships. Refunds within 5 business days if you return it.",
options: {
saveCard: true,
simulated: true
}
}
</script>

<template>
<StorefrontPaymentMethodsRadioAccordion v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordsthe step’s heading ("Payment")
introstringWordsone line above the choice
total*numberDatathe cart total in cents, from the server
methods*Method[]Datathe methods the merchant has configured: none offered, none shown
actionActionthe call to action: its words and the page action it runs
walletActionstringActionstarts a wallet payment (`{ id }`): the host opens the wallet’s own sheet; no action, no wallet button
reassurancestringWordsthe merchant’s real payment policy, one sentence, near the button ("Charged at shipping.")
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Method methods[] · 4 props
PropTypeDescription
id*stringthe method’s id
label*stringthe method’s name, as shown
kind*'wallet' | 'card' | 'paypal' | 'transfer' | 'other'what kind of method it is: wallet, card, paypal, transfer, other
notestringone sentence on how it works; for a transfer, the instructions
Action action · 2 props
PropTypeDescription
label*stringWordsthe pay button’s verb ("Pay")
action*stringActionpays: `{ method, saveCard? }`; without act the form posts them to its address
Options options · 3 props
PropTypeDescription
saveCardbooleanoffer "save this card" (unchecked by default)
simulatedbooleanpayments are a demo: say it plainly
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
What it asks your app for

The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
moneyformats a price, given in cents
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour word for an interface key, or undefined to keep the block’s own

The words it says itself, in English and French; label(key) replaces any of them:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo many attempts, try again in a moment.Trop de tentatives, réessayez dans un moment.

Features

  • Every word in the server HTML
  • Same markup in Vue and React
  • Theme tokens only: every theme, light and dark
  • Shows what you give it, invents nothing
  • No motion; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: checkout.pay, checkout.wallet
  • Reads payment_methods from your app

A storefront section, for checkout pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.

More storefront blocks

  • Party details lead plus names: the one who books in a full form, then the others as one compact roster, a row per guest: a larger party where only names (or a meal choice) are needed of the rest.
  • Party details per person: a card per guest, the one who books first with every field, the others with theirs, each added or removed in place beside the booking’s summary: a small party whose guests each need a few details.
  • Past lookbooks covers grid: past lookbooks as a grid of covers with their season and status: the archive of a brand that has history.
  • Payment explainer numbered rows: a trust section of the shop: what we see, what we keep, what cannot leak, as numbered rows.
  • Payment instalments plan schedule: the provider offers pay-in-full or N payments: the chosen plan shows its dated schedule and any extra cost.
  • Payment recovery actions list: a page of its own after a declined or failed payment: what happened, then up to three ways forward as stacked rows.
  • Payment recovery inline banner: a compact banner above the payment form when recovery happens in place: it takes the focus so the message is read.
  • Payment retry facts list: a payment that did not go through: the facts of the attempt, what happens next, retry or change the method.

All 409 storefront blocks