Saved cards card faces — Storefront block
Freestorefront-saved-cards-card-faces · for account, checkout pages
Saved cards card faces
Each saved card beside a neutral drawn face (its label, a chip mark, the last four digits, the expiry; no network logo): a customer with two or three cards who recognises them by sight.
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-saved-cards-card-facesUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontSavedCardsCardFaces from '@/components/trame/blocks/storefront/storefront-saved-cards-card-faces.vue'
const props = {
title: "Your payment methods",
cards: [
{
id: "method-a",
brand: "Bank card",
last4: "1842",
expiry: "08/2028",
default: true
},
{
id: "method-b",
brand: "Bank card",
last4: "7059",
expiry: "02/2025",
expired: true
}
],
explainer: "In this demo shop, the payment provider keeps your payment method. Your account only shows its name, its last digits and its expiry date.",
actions: {
remove: "remove-payment-method",
setDefault: "default-payment-method"
},
add: {
label: "Add a payment method",
action: "add-payment-method"
}
}
</script>
<template>
<StorefrontSavedCardsCardFaces v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe section’s heading |
| cards* | Card[] | Datathe customer’s saved payment cards |
| explainer* | string | Wordsthe actual storage arrangement, supplied by the merchant |
| actions* | Actions | the page actions the block runs, each described below |
| add | Add | the add link: its words and where it leads |
| pendingId | string | Datathe id of the card whose action is under way: it shows as busy |
| error | string | Wordswhat went wrong with the last action, as the host words it |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Card cards[] · 6 props
| Prop | Type | Description |
|---|---|---|
| id* | string | Datathe card’s id |
| brand* | string | Datathe card’s brand, e.g. "visa" |
| last4* | string | Datathe last four digits of the card number |
| expiry | string | Dataits expiry date, e.g. "08/27" |
| expired | boolean | true: the card has expired |
| default | boolean | true: the card used by default |
Actions actions · 2 props
| Prop | Type | Description |
|---|---|---|
| remove* | string | Actionremoves the card the customer confirms |
| setDefault | string | Actionmakes a card the default one |
Add add · 4 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe link’s words, e.g. "See the collection" |
| action | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action applies to, passed to the host with it, if any |
| url | string | Designan address outside the app |
Options options · 1 props
| Prop | Type | Description |
|---|---|---|
| mood | 'inverse' | 'brand' | 'warm' | 'tint' | string | a 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).
| Member | What it is for |
|---|---|
| href | the address an action leads to, or null to hide what leads there |
| act | runs a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error } |
| can | whether the page has this action |
| Link | your router’s link component |
| cartCount | the cart badge’s number |
| cartDrawer | whether your app has a cart drawer |
| cartOpen | whether the cart drawer is open |
| label | your 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:
| Key | English | French |
|---|---|---|
| newsletter.already | You are already subscribed. | Vous êtes déjà inscrit. |
| newsletter.done | Done: you are subscribed. | C’est noté : vous êtes inscrit. |
| newsletter.invalid | Check the email address. | Vérifiez l’adresse e-mail. |
| newsletter.tooMany | Too 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:
record.remove,record.default,add - Reads
payment_methodsfrom your app
A storefront section, for account, checkout pages; it uses @lucide/vue, class-variance-authority, clsx, reka-ui, tailwind-merge.
Built with
The components this block is made of; each one installs on its own too.
More storefront blocks
- Review snapshot distribution: a product page that wants the average and the five star bars at a glance, with a link to every review.
- Reviews summary bars: a product page: the average, the count and one bar per star beside the list of reviews; the merchant’s own only.
- Reviews summary cards grid: a home or a landing: many short reviews as cards, each with its stars, author and product; the merchant’s own only.
- Reviews summary pair: a product page that wants to be believed: the most helpful positive review beside the most helpful critical one; the merchant’s own only.
- Reviews summary photo wall: reviews that come with customers’ photos: a wall of pictures, each opening its full review; the merchant’s own only.
- Saved for later folded: a single line "Saved for later (3)" that opens on compact rows: a cart drawer or a long cart page where the saved products must not compete with the cart.
- Saved for later rows: a quiet list under the cart: a row per product with its picture, options, price (and how it moved since it was set aside) and the two buttons: the default for any shop.
- Saved for later shelf: picture cards in a row that scrolls sideways, the buttons under each: a shop whose products are recognised by their picture (fashion, decoration).