Membership ledger — Storefront block

Pro

storefront-membership-ledger · for home, product, landing pages

Membership ledger

The offer and its price on one side, a ruled list of perks with their yearly value on the other: a membership

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-membership-ledger

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontMembershipLedger from '@/components/trame/blocks/storefront/storefront-membership-ledger.vue'

const props = {
eyebrow: "Subscription",
title: "Your coffee, every month",
lead: "Choose the size of your box. It arrives at your door, freshly roasted, when you decide.",
offers: [
{
name: "Discovery Box",
price: 1900,
unit: "/ livraison",
monthly: 1900,
cadence: "One delivery a month",
contents: [
"2 coffees, 8.8 oz each",
"A tasting card"
],
image: "https://images.unsplash.com/photo-1695245503558-5cdb37f49092?w=1600&q=80",
alt: "An unlabeled kraft coffee bag on a light table",
note: "No commitment",
action: {
label: "Choose Discovery",
action: "subscribe",
record: {
id: "decouverte"
}
}
},
{
name: "Regular Box",
price: 3400,
unit: "/ livraison",
monthly: 3400,
cadence: "One delivery a month",
contents: [
"4 coffees, 8.8 oz each",
"A tasting card"
],
image: "https://images.unsplash.com/photo-1447933601403-0c6688de566e?w=1600&q=80",
alt: "Roasted coffee beans",
badge: "Most chosen",
action: {
label: "Choose Regular",
action: "subscribe",
record: {
id: "habitue"
}
}
}
],
perks: [
{
label: "Free shipping",
text: "On every order all year",
value: "$48"
},
{
label: "A rare coffee on your anniversary",
text: "Chosen by our roaster",
value: "$18"
}
],
perksTotal: "Value over the year: $126",
assurance: "You can postpone, pause or cancel from your account, whenever you like."
}
</script>

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

Props

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

PropTypeDescription
eyebrowstringWordswhat this is ("Subscription")
title*stringWordsthe section’s title, in a few words ("Your coffee, every month")
leadstringWordsone or two sentences under the title: what arrives, how often
offers*Offer[]the membership offers, each with its price
perks*Perk[]what members get, e.g. "Free delivery"
perksTotalstringWordsthe total of the perks, as the merchant states it ("Value over the year: €180")
assurancestringWordswhat reassures about leaving ("Pause, postpone or cancel in one click"), only what is true
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Offer offers[] · 12 props
PropTypeDescription
name*stringWordsthe offer’s name ("Discovery Box")
pricenumberDatathe price of one delivery (or of the membership) in cents
priceLabelstringWordswords instead of an amount ("Free the first month")
unitstringWordswhat the price is per ("/ delivery", "/ year")
monthlynumberDatathe per-month equivalent in cents, only when the merchant states it
cadencestringWordshow often it arrives ("A delivery every 4 weeks"), as the merchant’s system does it
contentsstring[]Wordsone thing in the box, or one inclusion
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows, when the words do not say it
notestringWordsa line under the price ("No commitment"), as the merchant wrote it
badgestringWordsthe merchant’s own mark for this offer ("Most chosen")
actionActionthe offer’s call to action: its words and the page action
Action offers[].action · 3 props
PropTypeDescription
label*stringWordswhat happens ("Choose this box")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Perk perks[] · 3 props
PropTypeDescription
label*stringWordsthe perk ("Free delivery")
textstringWordswhat it means in one line
valuestringWordsits yearly value, as the merchant states it ("€48")
Options options · 1 props
PropTypeDescription
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
Linkyour router’s link component
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
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: offers[].action

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

Built with

The components this block is made of; each one installs on its own too.

More storefront blocks

  • Member savings bars: show a member what the programme saved them, period by period, in their own figures.
  • Member tiers beside picture: a programme with one or two levels: the tiers as cards beside a picture.
  • Member vs guest columns: the benefits on one side, the member’s calculation and the guest’s alternative on the other: an offer that is only worth it if the sums are shown.
  • Membership benefits table: explain what membership changes: the perks row by row, without it and with it.
  • Membership plan beside: the plan card held beside every perk with its fine print: a programme whose perks need reading before joining.
  • Membership plan card: sell the membership: the plan with its price, its main perks and one button.
  • Membership worked example: convince a doubter: a worked example with the programme’s real rules and where it pays for itself.
  • Menu blackboard: a menu as a blackboard: the whole carte as typography on a dark band, for a short, changing carte.

All 409 storefront blocks