Product offer panel frequency — Storefront block
Prostorefront-product-offer-panel-frequency · for product pages
Product offer panel frequency
A product bought once or on subscription: two selectable cards, the saving as a number, a button that restates the choice
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-product-offer-panel-frequencyUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductOfferPanelFrequency from '@/components/trame/blocks/storefront/storefront-product-offer-panel-frequency.vue'
const props = {
title: "How to buy it",
product: {
id: "cafe-1",
name: "Tamanrasset whole-bean coffee, 2.2 lb",
price: 2400
},
modes: [
{
id: "once",
label: "One-time purchase",
price: 2400,
note: "Whenever you like"
},
{
id: "every-4",
label: "Every 4 weeks",
price: 2000,
period: "/ 4 weeks",
note: "Skip or stop at any time"
}
],
reassurance: "Cancel any time from your account, free of charge.",
action: {
label: "Subscribe",
action: "add-to-cart",
record: {
id: "cafe-1"
}
}
}
</script>
<template>
<StorefrontProductOfferPanelFrequency v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the buyer chooses ("How to receive it") |
| intro | string | Wordsone sentence on the choice |
| product | Product | the product: its price is the one the button states when the mode has none |
| modes* | Mode[] | Datathe purchase modes of the product, as the shop sells them |
| reassurance | string | Wordsa real policy line ("Cancel anytime from your account") |
| action* | Action | the call to action: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Product product · 4 props
| Prop | Type | Description |
|---|---|---|
| id* | string | number | Datathe record’s id in the tool that answers it |
| name* | string | Wordsthe product’s name |
| price* | number | an amount in cents |
| currency | string | DesignISO 4217, EUR by default |
Mode modes[] · 5 props
| Prop | Type | Description |
|---|---|---|
| id* | string | the mode’s id |
| label* | string | the mode ("One-time purchase", "Every 4 weeks", "Home delivery") |
| price | number | the price in this mode, in cents |
| period | string | what the price covers ("/ 4 weeks") |
| note | string | one line on the mode ("Cancel anytime"), the merchant’s own |
Action action · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the button says before the amount ("Subscribe", "Add the bundle to the cart") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens; the chosen mode or store id is added |
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 |
| money | formats a price, given in cents |
| 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
- Subtle motion: one short reveal; still under reduced motion
- Real buttons and links, a visible focus
- Asks your app through actions:
action - Reads
productsfrom your app
A storefront section, for product pages; it uses 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
- Product grid rows: a dense list, one product per row with its summary and options: for large catalogues and visitors who compare facts.
- Product grid: the catalogue’s standard grid, four columns on a wide screen: every product equal, so a visitor compares quickly.
- Product hotspots markers: a product seen as a whole where details matter (a bag, a watch): numbered markers on one picture, the list beside it.
- Product information sheet drawer: Long materials, ingredients or care copy in a side panel opened from compact rows; the merchant’s own only.
- Product overview filmstrip: a strip of landscape pictures edge to edge, then the facts, the buy box and the description side by side: furniture and wide objects photographed in rooms.
- Product overview minimal spec: one picture, the options and a definition list of facts: a catalogue with few photos or technical goods.
- Product overview mosaic: one lead picture and the others as a two-column grid under it, the buy box beside: a product with 3 to 7 pictures of equal interest (a bag, a jacket).
- Product overview poster panel: the first picture as a wide panel carrying the product’s one-line summary, its story and three of its highlights, a narrow buy box beside it and the other facts in a band under both: a single-product shop or a hero product whose page should read like a landing.