Recent purchases pill — Storefront block

Free

storefront-recent-purchases-pill · for product, home pages

Recent purchases pill

A compact pill with the buyer’s initial, one line and the measured figures beside it: a quiet product page where a card would be too much; the merchant’s real orders only, never looped

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-recent-purchases-pill

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontRecentPurchasesPill from '@/components/trame/blocks/storefront/storefront-recent-purchases-pill.vue'

const props = {
title: "Recently ordered from the workshop",
purchases: [
{
id: "c-2041",
product: {
id: "bols-mouchetes",
name: "Speckled stoneware bowls, set of two",
image: "https://images.unsplash.com/photo-1530006498959-b7884e829a04?w=400&q=80",
alt: "Two speckled white stoneware bowls stacked on a dark background"
},
buyer: "Camille",
town: "Portland",
ago: "4 min ago"
},
{
id: "c-2040",
product: {
id: "mug-bleu",
name: "Blue stoneware mug and tumbler",
image: "https://images.unsplash.com/photo-1733046889345-25938f38c8e7?w=400&q=80",
alt: "A blue stoneware mug and small tumbler on a wooden place mat"
},
town: "Sacramento",
ago: "18 min ago"
}
],
counts: [
{
kind: "viewing",
value: 14,
label: "people are viewing this page"
},
{
kind: "sold",
value: 23,
label: "pieces sold today"
}
],
open: "product",
dismissLabel: "Hide recent orders",
options: {
floating: false
}
}
</script>

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

Props

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

PropTypeDescription
titlestringWordsthe card’s name for screen readers and the strip ("Recently ordered")
purchases*Purchase[]the shop’s latest real orders, newest first; none: the host renders no block
countsCount[]only the figures the shop really measures; none rather than a guess
openstringActionthe product page a purchase links to
dismissLabelstringWordsthe close button’s words for screen readers ("Hide recent purchases")
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Purchase purchases[] · 5 props
PropTypeDescription
id*string | numberDatathe order’s id in the shop, never shown
product*Productthe product bought
buyerstringWordsthe buyer’s first name, only when they agreed to show it; without it the block says "A customer"
townstringWordsthe delivery town, only when the buyer agreed to show it
ago*stringWordshow long ago, as the host writes it at render time ("12 min ago"); orders older than 48 h are not passed
Product purchases[].product · 4 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
Count counts[] · 3 props
PropTypeDescription
kind*'viewing' | 'sold'viewing: people on the page now; sold: units sold today
value*numberDatathe figure the shop measured, never estimated
label*stringWordsthe words after the figure ("people are looking", "sold today")
Options options · 3 props
PropTypeDescription
position'start' | 'end'the bottom corner it sits in, start by default
floatingbooleanfixed to the screen (the default); false sets it in the page flow, as in a preview
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
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: open
  • Reads orders from your app

A storefront section, for product, home pages; it uses @lucide/vue.

Built with

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

More storefront blocks

  • Rate table: a grid of the merchant’s own rates (shipping by zone, repair pricing): rows against columns, stacked cards on a phone.
  • Rating criteria bars: a product rated by several criteria: the overall note and one labelled bar per criterion; the merchant’s own only.
  • Rating link inline: a buy box that is already full: just the stars and the count beside the title, linking to the reviews.
  • Recently viewed grid: a history page or an empty search: the products in a grid, as many columns as the count allows.
  • Recently viewed rail: under a product page or on the home page: full product cards in a scrolling row with arrows and a clear button.
  • Recipient details opt in card: recipient name and phone in a bordered card under an opt-in checkbox, with a hide-prices choice only when the merchant supports it: a parcel that goes to someone else.
  • Referral account card: inside the customer’s account: the link, what was earned, and the list of invitations with their status in one card.
  • Referral hero: the programme is a page of its own: a big promise, what each side gets as two cards joined by a plus, the link to copy.

All 409 storefront blocks