Seconds savings table — Storefront block
Prostorefront-seconds-savings-table · for home, catalog, landing pages
Seconds savings table
A table of each second against its price new, with the saving: a shop that sells many seconds and wants them compared
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-seconds-savings-tableUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontSecondsSavingsTable from '@/components/trame/blocks/storefront/storefront-seconds-savings-table.vue'
const props = {
title: "Seconds",
lead: "A stitching flaw, a damaged box, a return tried on once: every piece is inspected, its flaw is written down, and its price drops to match.",
grades: [
{
grade: "A",
text: "A finishing detail or damaged packaging: the product is as good as new."
},
{
grade: "B",
text: "A cosmetic flaw visible up close, with no effect on use or durability."
}
],
items: [
{
id: 1,
name: "Open Air jacket",
price: 12900,
compareAt: 18900,
image: "https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=1600&q=80",
alt: "An orange windbreaker on a hanger",
grade: "A",
defect: "Pocket zipper came unstitched and was sewn back by hand. No effect on use.",
note: "One-year warranty"
},
{
id: 2,
name: "City backpack 22 L",
price: 4900,
compareAt: 7900,
image: "https://images.unsplash.com/photo-1680039211156-66c721b87625?w=1600&q=80",
alt: "A black flap backpack against a yellow background",
grade: "B",
defect: "Slight stain on the left strap that barely comes out in the wash.",
note: "One-year warranty"
}
],
open: "product",
more: {
label: "See all seconds",
action: "collection",
record: {
id: "secondes"
}
},
options: {
eyebrow: "Seconds"
}
}
</script>
<template>
<StorefrontSecondsSavingsTable v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordswhat the page shows ("Seconds") |
| lead | string | Wordswhy these items are second choices, in the merchant’s own words |
| grades | Grade[] | the merchant’s grade scale |
| items* | Item[] | Datathe second-choice products, each with its grade and its defect |
| open | string | Actionthe page action a product opens; it receives the product |
| more | More | the see-more link: its words and the page action it runs |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Grade grades[] · 2 props
| Prop | Type | Description |
|---|---|---|
| grade* | string | Wordsa grade, spelled as in the products |
| text* | string | Wordswhat it means ("No visible defect, damaged packaging") |
Item items[] · 11 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 |
| compareAt | number | the price before the merchant’s reduction |
| image | string | null | Picturethe main picture; null or absent: the product has none yet |
| alt | string | Wordswhat the main picture shows |
| category | string | Wordsthe product’s category, e.g. "Knitwear" |
| available | boolean | false: sold out; true or absent: can be bought |
| grade* | string | Wordsthe grade the merchant gives it ("A", "B", "Refurbished") |
| defect* | string | Wordsthe honest reason it is a second ("Small ink stain on the lining, no effect on use") |
| note | string | Wordsa precision on its condition or its warranty ("One-year guarantee") |
More more · 3 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat happens ("See all second-hand items") |
| action* | string | Actiona named action of the page |
| record | Record<string, unknown> | Datathe record the action opens, if any |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| eyebrow | string | Wordsa small line above the title |
| 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 |
| asset | a picture’s address as your app serves it |
| 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:
open,more - Reads
productsfrom your app
A storefront section, for home, catalog, 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
- Search panel top sheet: a wide band under the header, the field across the width, popular searches as a column of words beside product tiles: a large catalogue.
- Search panel: the same content in a compact panel under the header: a search that opens from the header.
- Search results grouped: every group on the page at once, products large and the categories and articles in a side column: for shops with a rich journal or many categories.
- Search results tabs: one group at a time (products, categories, articles) behind a tab row with real counts: for shops where products are what people want and the rest is a side road.
- Service glossary: the terms a service uses, each with its meaning and price: a repair glossary, a duty glossary.
- Shared list with comments: a list kept by several people, with who added what and the comments: a household, a gift list.
- Shared list with progress: a gift list shared with guests (wedding, birth, moving in): what is wanted, how many are already given, and "Give" on each, with the list’s progress beside.
- Shoot notes margin notes: a few big frames each with a short note written like a margin comment, and the budget line: the making-of of a collection.