Product dimensions diagram — Storefront block
Prostorefront-product-dimensions-diagram · for product pages
Product dimensions diagram
A dimension drawing with exact measurements, enlarged in a dialog with an all-media tab; the merchant’s own 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-product-dimensions-diagramUsage
Its demo data, shortened (Using blocks).
<script setup lang="ts">
import StorefrontProductDimensionsDiagram from '@/components/trame/blocks/storefront/storefront-product-dimensions-diagram.vue'
const props = {
title: "Specifications",
intro: "Measured on the finished product, in our workshop.",
groups: [
{
title: "Dimensions",
rows: [
{
label: "Height",
value: "20.5 in"
},
{
label: "Width",
value: "11.8 in"
}
]
},
{
title: "Materials",
rows: [
{
label: "Outside",
value: "Coated cotton canvas, 12.4 oz/yd²"
},
{
label: "Lining",
value: "Recycled polyester"
}
]
}
],
diagram: "data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 600 500%22 fill=%22none%22 stroke=%22currentColor%22 stroke-width=%222%22%3E %3Crect width=%22600%22 height=%22500%22 fill=%22white%22 stroke=%22none%22/%3E %3Cpath d=%22M205 150Q205 110 250 110H330Q375 110 375 150L390 365Q290 395 190 365Z%22/%3E %3Cpath d=%22M250 110V85Q250 65 270 65H310Q330 65 330 85V110M210 175Q290 200 370 175M218 255H362V335Q290 350 218 335ZM245 190V220M335 190V220%22/%3E %3Cpath d=%22M150 65V385M140 75L150 65L160 75M140 375L150 385L160 375M190 420H390M200 410L190 420L200 430M380 410L390 420L380 430M175 65H130M175 385H130M190 395V445M390 395V445%22/%3E %3Cg fill=%22currentColor%22 stroke=%22none%22 font-family=%22sans-serif%22 font-size=%2220%22%3E%3Ctext x=%22112%22 y=%22225%22 text-anchor=%22middle%22 transform=%22rotate(-90 112 225)%22%3E20.5 in%3C/text%3E%3Ctext x=%22290%22 y=%22460%22 text-anchor=%22middle%22%3E11.8 in%3C/text%3E%3C/g%3E %3C/svg%3E",
measurements: [
{
label: "Height",
value: "20.5 in"
},
{
label: "Width",
value: "11.8 in"
}
],
media: [
{
src: "data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 600 500%22 fill=%22none%22 stroke=%22currentColor%22 stroke-width=%222%22%3E %3Crect width=%22600%22 height=%22500%22 fill=%22white%22 stroke=%22none%22/%3E %3Cpath d=%22M205 150Q205 110 250 110H330Q375 110 375 150L390 365Q290 395 190 365Z%22/%3E %3Cpath d=%22M250 110V85Q250 65 270 65H310Q330 65 330 85V110M210 175Q290 200 370 175M218 255H362V335Q290 350 218 335ZM245 190V220M335 190V220%22/%3E %3Cpath d=%22M150 65V385M140 75L150 65L160 75M140 375L150 385L160 375M190 420H390M200 410L190 420L200 430M380 410L390 420L380 430M175 65H130M175 385H130M190 395V445M390 395V445%22/%3E %3Cg fill=%22currentColor%22 stroke=%22none%22 font-family=%22sans-serif%22 font-size=%2220%22%3E%3Ctext x=%22112%22 y=%22225%22 text-anchor=%22middle%22 transform=%22rotate(-90 112 225)%22%3E20.5 in%3C/text%3E%3Ctext x=%22290%22 y=%22460%22 text-anchor=%22middle%22%3E11.8 in%3C/text%3E%3C/g%3E %3C/svg%3E",
alt: "Front drawing of the bag with its height and width dimensions."
}
],
options: {
diagramAlt: "Front view of the bag: height 20.5 in, width 11.8 in."
}
}
</script>
<template>
<StorefrontProductDimensionsDiagram v-bind="props" />
</template>Props
Each prop says who changes it: Words, Picture, Action, Design, Data.* required.
| Prop | Type | Description |
|---|---|---|
| title* | string | Wordsthe block’s title ("Features") |
| intro | string | Wordsone sentence on what the details cover |
| groups | Group[] | the groups shown, in order |
| summary | string | Wordsan honest line on the results or the changes, as the merchant wrote it |
| diagram | string | Picturethe merchant’s dimension drawing, including its measurement arrows |
| measurements* | Measurement[] | the product’s measurements, each a label and a value |
| media | Media[] | pictures showing the dimensions |
| options | Options | the block’s settings: layout choices and secondary words, read by every variant |
Group groups[] · 2 props
| Prop | Type | Description |
|---|---|---|
| title | string | Wordsthe group ("Dimensions", "Materials") |
| rows* | Row[] | the group’s rows, in order |
Row groups[].rows[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the value is about |
| value* | string | Wordsthe value, as the merchant states it |
Measurement measurements[] · 2 props
| Prop | Type | Description |
|---|---|---|
| label* | string | Wordswhat the value is about |
| value* | string | Wordsthe exact measurement supplied by the merchant |
Media media[] · 2 props
| Prop | Type | Description |
|---|---|---|
| src* | string | Picturea picture: a root-relative path (/media/…) or an absolute URL |
| alt* | string | Wordswhat the picture shows |
Options options · 2 props
| Prop | Type | Description |
|---|---|---|
| diagramAlt | string | Wordsdescription of the dimension drawing |
| 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 |
| asset | a picture’s address as your app serves it |
| 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
A storefront section, for product 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
- Product compare swipe: phone-first: columns scroll sideways and snap, the attribute names pinned; chosen automatically beyond four products.
- Product compare table: two to four models side by side in a plain grid, the current one tinted: the usual comparison of a small range.
- Product configurator compact: a product page’s buy box with one or two options: a thumbnail, the choices in a row, the total and the button, no second column.
- Product configurator side by side: a made-to-order page of its own: the picture stays in view on one side while every option runs down the other, the recap at the end.
- Product facets radial: one product with 3 to 6 named facets around its picture: a single object seen from several sides.
- Product features accordion picture: a few features that each deserve a sentence: a picture beside an accordion, the picture following the open panel.
- Product features alternating: the usual story of a product: a picture and a selling point per row, sides swapping each time.
- Product features figures: a product with real numbers to show (years of warranty, tests passed): the figures first, then the features in rows.