Fit by size tabs — Storefront block

Pro

storefront-fit-by-size-tabs · for product pages

Fit by size tabs

A size at a time: a row of size chips, and under it that size’s measurements and the models who wear it, to picture it before choosing

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-fit-by-size-tabs

Usage

Its demo data, shortened (Using blocks).

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

const props = {
title: "Find your size",
intro: "Our measurements are taken flat on the finished garment. Compare them with a piece you already wear.",
chart: {
columns: [
"Chest (cm)",
"Waist (cm)"
],
rows: [
{
size: "XS",
values: [
84,
70
]
},
{
size: "S",
values: [
90,
76
]
}
]
},
models: [
{
name: "Ivy",
size: "S",
image: "https://images.unsplash.com/photo-1538516089546-40b08c9c9866?w=1600&q=80",
alt: "Ivy in a navy rain jacket, size S",
height: "5′4″",
measurements: [
{
label: "Chest",
value: "86 cm"
},
{
label: "Waist",
value: "68 cm"
}
],
note: "Fitted cut, sleeves the right length."
},
{
name: "Hugo",
size: "L",
image: "https://images.unsplash.com/photo-1578100044626-110806c15b00?w=1600&q=80",
alt: "Hugo in a denim jacket, size L",
height: "5′11″",
measurements: [
{
label: "Chest",
value: "98 cm"
},
{
label: "Waist",
value: "82 cm"
}
],
note: "A little room in the shoulders, comfortable over a sweater."
}
]
}
</script>

<template>
<StorefrontFitBySizeTabs 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
models*Model[]the models who wear the piece, each with their size and measurements
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
Model models[] · 7 props
PropTypeDescription
name*stringWordsa first name or a label ("Model 1"), a real model of the merchant
imagestringPicturea picture: a root-relative path (/media/…) or an absolute URL
altstringWordswhat the picture shows
heightstringWords("1.78 m")
measurementsMeasurement[]the model’s measurements, each a label and a value
size*stringWordsthe size worn ("M")
notestringWordshow it fits this person
Measurement models[].measurements[] · 2 props
PropTypeDescription
label*stringWordswhat the value is about
value*stringWordsthe value, as the merchant states it
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
asseta picture’s address as your app serves it
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

  • Featured selection flanked: the first product in the middle on a tinted stage with its two buttons, the others flanking it in two columns like pieces either side of a shop window: one product to crown, with three to six around it; the merchant’s own products and figures only.
  • Featured selection grid: the first product double-sized with two buttons, then a grid: one product to push among others; the merchant’s own products and figures only.
  • Finder intro card: A question prompt, step count and image strip invite the visitor to start the quiz, with micro motion only.
  • Finder results cards: Recommended product cards with reasons, restart and see-all actions conclude a quiz; the merchant’s own rules only, with micro motion only.
  • Fit models cards: clothes worn by real people: height, measurements and the size each one wears, to compare with oneself.
  • Floating products staggered: two staggered columns of tall cards whose pictures drift at opposite paces as the page scrolls: an editorial run of 4 to 12 products; the merchant’s own products and figures only.
  • Fulfilment choice cards: a product that can be delivered or picked up: a switch and the stores with their distance and stock.
  • Fulfilment estimator card: a bordered card listing every shipping option with its delay and price: a cart or a product with several carriers.

All 409 storefront blocks