Offer popup code — Storefront block
Prostorefront-offer-popup-code · for home, catalog pages
Offer popup code
A centered selectable code with its terms in the host's dialog; the merchant's own offer only.
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-offer-popup-codeUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontOfferPopupCode from '@/components/trame/blocks/storefront/storefront-offer-popup-code.vue'
const props = {
title: "News from the workshop",
lead: "Get our making-of notebooks and the new pieces.",
submit: {
label: "Get the notebook",
action: "subscribe"
},
consent: "I’d like to receive news from the workshop by email.",
terms: "You can unsubscribe from any message.",
dismissLabel: "Continue browsing",
rememberLabel: "Don’t offer me this sign-up again"
}
</script>
<template>
<StorefrontOfferPopupCode 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 |
| lead | string | Wordsa sentence or two under the heading |
| code | string | Wordsthe merchant’s real fixed code |
| terms | string | Wordsthe merchant’s actual offer terms or subscription explanation |
| submit | Submit | the submit action: its words and the page action it runs |
| consent | string | Wordsexplicit subscription consent, never preselected |
| dismissLabel | string | Wordsthe close button’s words, instead of the block’s own |
| rememberLabel | string | Wordsthe words beside a "do not show again" box; absent: no box |
| status | string | Wordsserver response, never inferred from a click |
| error | string | Wordsthe host’s refusal, shown under the form |
| busy | boolean | true: the host is sending the form; the button shows it |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Submit submit · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordsthe words on the button or link |
| action* | string | Actionsubscribes the e-mail typed |
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 |
| 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:
subscribe
A storefront section, for home, catalog pages; it uses @lucide/vue, @vueuse/core, 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
- Menu blackboard: a menu as a blackboard: the whole carte as typography on a dark band, for a short, changing carte.
- Menu classic: a written menu for a table that reads: sections in two columns, each dish with its price at the end of a dotted line.
- Menu pictured: a menu that sells by the picture: dishes as cards with their photo, for a kitchen with good photos of most plates.
- Mini cart compact: a short cart on a page of its own, or a mini-cart panel: small rows in one bordered card, the total and the way to pay held in its footer.
- Mini cart receipt: a short cart with character, for a shop with a crafted or retro voice: a narrow till-receipt ticket, each line running to its price along a dotted leader, the total under a double rule.
- Offers panel drawer: a slim band naming the offers that opens a side sheet of picture rows, sides alternating: several offers worth a look without taking the page; the merchant’s own offers only.
- Offers panel inline strip: the offers as a row of cards on the page, scrolling sideways past three: when no overlay is wanted; the merchant’s own offers only.
- Offers panel launcher stack: a small pill fixed at the bottom corner with the count, opening a compact card of thumbnail rows: offers always at hand on a catalogue or cart page; the merchant’s own offers only.