Size fit chart — Storefront block

Pro

storefront-size-fit-chart · for product pages

Size fit chart

A plain size table of measurements, with a cm / in switch and a first column that stays in view

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-size-fit-chart

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontSizeFitChart from '@/components/trame/blocks/storefront/storefront-size-fit-chart.vue'

const props = {
title: "Find your size",
intro: "Our measurements are taken flat on the finished garment. Compare them with something you already wear.",
chart: {
columns: [
"Chest",
"Waist"
],
rows: [
{
size: "XS",
values: [
84,
70
]
},
{
size: "S",
values: [
90,
76
]
}
]
}
}
</script>

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

Props

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

PropTypeDescription
title*stringWordsthe block’s title ("Size guide")
introstringWordshow to read it, or how to measure ("Measure yourself without thick clothing"), as the merchant wrote it
chart*ChartDatathe size table; numbers are centimetres and convert to inches, strings stay as written
unitstringDesigncm | in: the unit the chart opens in
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Chart chart · 2 props
PropTypeDescription
columns*string[]measurements, in the order of each row’s values ("Chest")
rows*Row[]the chart’s rows, in order
Row chart.rows[] · 2 props
PropTypeDescription
size*stringthe size, e.g. "M"
values*(number | string)[]the measurements for this size, one per column
Options options · 2 props
PropTypeDescription
unitTogglebooleanoffer the cm / in switch on the chart (on by default)
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
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

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

  • Shoppable reviews photo rail: reviews that come with a photo of the product in use: wide cards in a row that scrolls, the words beside the customer’s photo and the product under them; the merchant’s own reviews only.
  • Shoppable reviews product posters: furniture, decor or any product whose picture sells: tall posters, the review on a calm top band and the product’s picture filling the rest; the merchant’s own reviews only.
  • Shoppable reviews scene carousel: a few strong reviews on a premium shop: one at a time in a large framed panel, a tall picture with the product card on its foot, arrows and dots, nothing moves by itself; the merchant’s own reviews only.
  • Shoppable scene popover card: one large scene with plus markers and a card for the chosen product beside it: a scene to explore piece by piece.
  • Size availability matrix: a two-axis product (waist by length) where each size is in stock or made to order: a grid of dots.
  • Spec revisions ledger: one row per change: the old value struck, the new one, and why: a product that changed between versions; the merchant’s own changes only.
  • Specification figures ledger: a long specification (furniture, appliances, tech): each group a titled chapter, its rows joined to their values by a dotted leader, like a printed data sheet.
  • Stage timeline: a service that takes time (repair, mail-in, cross-border delivery): the stages with their durations, the deciding one marked.

All 409 storefront blocks