Skip to content
Commerce block

Size Guide

The panel that decides whether the parcel comes back: what the model is wearing and what previous buyers did, above a table whose inches are converted rather than maintained twice.

227 lineslucide-reactAdded 27 Aug 2026Updated 11 Sept 2026
  • size
  • guide
  • apparel
  • measurements
  • returns

What's included

  • components/product-size-guide.tsx
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add product-size-guide

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Start a page with this section — add more, order them, and leave with the page source.

Preview

Size guide — Heavyweight Oxford Shirt

Measurements are of the body, not the garment.

Units

The model is 1.78m and wears a medium.

9 in 10 buyers kept their usual size. The 1 in 10 who exchanged went up, not down.

Body measurements by size, in centimetres.
SizeChest (cm)Around the fullest part, under the arms, tape level and not pulled tight.Waist (cm)Around the narrowest part, usually just above the navel.Sleeve (cm)From the centre back of the neck, over the shoulder, to the wrist.
XS81–8666–7161
S86–9171–7663
Mworn by the model96–10181–8664
L106–11191–9666
XL116–121101–10667
XXL126–131111–11669

Between two sizes on chest and waist? This shirt is cut straight, so take the larger — that is what the exchanges above did.

Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.

Source

components/product-size-guide.tsx
'use client'

/**
 * <ProductSizeGuide> — the panel that decides whether the parcel comes back.
 *
 * Product Detail had the gallery, the buy box, the info accordion and the
 * review summary. The size guide is the one surface on a clothing page
 * with a measurable return on getting it right: the majority of apparel
 * returns are "wrong size", and every one of them is a shipped parcel, a
 * refund and a restock.
 *
 * THE ONE THING THIS GETS RIGHT THAT MOST DO NOT
 *
 * It answers the question people actually have, which is not "what is the
 * chest measurement of a medium" — it is "what should I buy". So the two
 * pieces of evidence that answer it are above the table, not below it:
 * what the model is wearing next to their height, and what previous buyers
 * did. "Nine in ten kept their usual size" is a fact from the returns data
 * that costs nothing to surface and outperforms the entire table.
 *
 * CENTIMETRES AND INCHES ARE THE SAME TABLE
 *
 * The toggle converts; it does not swap in a second, differently rounded
 * table, and it does not scroll you back to the top. Rounding is done once
 * at display, so 96cm is 37.8in rather than the 38 that a hand-maintained
 * inch table would carry — and the row you were reading stays where it is.
 *
 * HOW TO MEASURE IS PART OF THE GUIDE
 *
 * A chest measurement is useless if two people take it differently. One
 * line per row, in the table, rather than a separate diagram nobody opens.
 *
 * THE TABLE SCROLLS, THE PAGE DOES NOT
 *
 * Six columns will not fit a phone, so the table gets its own horizontal
 * scroll container with the size column pinned. A page that scrolls
 * sideways because of one table is a broken page.
 *
 * ACCESSIBILITY: a real `<table>` with `<caption>`, `scope="col"` and
 * `scope="row"` — a screen reader then reads "Medium, chest, 96 to 101
 * centimetres" instead of a stream of numbers. The unit toggle is a
 * labelled radio group, so it is one control with two states rather than
 * two buttons that both look pressed.
 */

import * as React from 'react'
import { Info, Ruler } from 'lucide-react'

export interface SizeRow {
  size: string
  /** Centimetres, always. Inches are computed, never stored twice. */
  chest: [number, number]
  waist: [number, number]
  sleeve: number
}

export interface ProductSizeGuideProps {
  productName?: string
  rows?: SizeRow[]
  modelNote?: string
  /** From returns data — the single most useful line on the panel. */
  fitNote?: string
  className?: string
}

const DEFAULT_ROWS: SizeRow[] = [
  { size: 'XS', chest: [81, 86], waist: [66, 71], sleeve: 61 },
  { size: 'S', chest: [86, 91], waist: [71, 76], sleeve: 62.5 },
  { size: 'M', chest: [96, 101], waist: [81, 86], sleeve: 64 },
  { size: 'L', chest: [106, 111], waist: [91, 96], sleeve: 65.5 },
  { size: 'XL', chest: [116, 121], waist: [101, 106], sleeve: 67 },
  { size: 'XXL', chest: [126, 131], waist: [111, 116], sleeve: 68.5 },
]

const MEASURE_HELP: Record<string, string> = {
  Chest: 'Around the fullest part, under the arms, tape level and not pulled tight.',
  Waist: 'Around the narrowest part, usually just above the navel.',
  Sleeve: 'From the centre back of the neck, over the shoulder, to the wrist.',
}

export function ProductSizeGuide({
  productName = 'Heavyweight Oxford Shirt',
  rows = DEFAULT_ROWS,
  modelNote = 'The model is 1.78m and wears a medium.',
  fitNote = '9 in 10 buyers kept their usual size. The 1 in 10 who exchanged went up, not down.',
  className = '',
}: ProductSizeGuideProps) {
  const [unit, setUnit] = React.useState<'cm' | 'in'>('cm')
  /*
    The size the model is wearing, marked in the table as well as named
    above it. Not a click target: a row that only responds to a mouse is a
    control keyboard users cannot reach, and this one has nothing to say
    that the marking does not already say.
  */
  const modelSize = 'M'

  /* Rounded once, at display. There is no second table to drift. */
  const value = (cm: number) => (unit === 'cm' ? cm : cm / 2.54)
  const show = (cm: number) => {
    const v = value(cm)
    return unit === 'cm' ? `${Math.round(v)}` : v.toFixed(1)
  }
  const range = ([a, b]: [number, number]) => `${show(a)}–${show(b)}`

  return (
    <section className={`mx-auto w-full max-w-3xl px-4 py-16 sm:px-6 ${className}`}>
      <div className="rounded-2xl border border-border bg-card p-5 sm:p-6">
        <div className="flex flex-wrap items-start justify-between gap-3">
          <div>
            <h2 className="flex items-center gap-2 text-base font-semibold text-foreground">
              <Ruler aria-hidden className="h-4 w-4 text-muted-foreground" />
              Size guide — {productName}
            </h2>
            <p className="mt-1 text-xs text-muted-foreground">
              Measurements are of the body, not the garment.
            </p>
          </div>

          {/* One control with two states, not two buttons that both look on. */}
          <fieldset className="shrink-0">
            <legend className="sr-only">Units</legend>
            <div className="flex rounded-lg border border-border bg-background p-0.5">
              {(['cm', 'in'] as const).map((u) => (
                <label
                  key={u}
                  className={`cursor-pointer rounded-md px-3 py-1 text-sm font-medium transition focus-within:ring-2 focus-within:ring-ring ${
                    unit === u
                      ? 'bg-primary text-primary-foreground'
                      : 'text-muted-foreground hover:text-foreground'
                  }`}
                >
                  <input
                    type="radio"
                    name="size-guide-unit"
                    value={u}
                    checked={unit === u}
                    onChange={() => setUnit(u)}
                    className="sr-only"
                  />
                  {u === 'cm' ? 'Centimetres' : 'Inches'}
                </label>
              ))}
            </div>
          </fieldset>
        </div>

        {/* The two facts that answer the real question, before the table. */}
        <div className="mt-4 grid gap-2 sm:grid-cols-2">
          <p className="rounded-xl border border-border bg-muted/50 px-3 py-2 text-sm text-foreground">
            {modelNote}
          </p>
          <p className="rounded-xl border border-border bg-muted/50 px-3 py-2 text-sm text-foreground">
            {fitNote}
          </p>
        </div>

        {/* Its own scroll container — the page must not scroll sideways. */}
        <div className="mt-5 -mx-1 overflow-x-auto px-1">
          <table className="w-full min-w-[34rem] border-collapse text-start text-sm">
            <caption className="sr-only">
              Body measurements by size, in {unit === 'cm' ? 'centimetres' : 'inches'}.
            </caption>
            <thead>
              <tr className="border-b border-border">
                <th
                  scope="col"
                  className="sticky start-0 z-10 bg-card px-3 py-2 text-xs font-medium text-muted-foreground"
                >
                  Size
                </th>
                {(['Chest', 'Waist', 'Sleeve'] as const).map((label) => (
                  <th key={label} scope="col" className="px-3 py-2 align-top">
                    <span className="block text-xs font-medium text-muted-foreground">
                      {label} ({unit})
                    </span>
                    {/* How to measure, in the table rather than a diagram. */}
                    <span className="mt-0.5 block max-w-44 text-[11px] font-normal leading-snug text-muted-foreground">
                      {MEASURE_HELP[label]}
                    </span>
                  </th>
                ))}
              </tr>
            </thead>
            <tbody className="divide-y divide-border">
              {rows.map((row) => {
                const on = modelSize === row.size
                return (
                  <tr key={row.size} className={on ? 'bg-accent/50' : undefined}>
                    <th
                      scope="row"
                      className={`sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground ${
                        on ? 'bg-accent/50' : 'bg-card'
                      }`}
                    >
                      {row.size}
                      {on ? (
                        <span className="block text-[11px] font-normal text-muted-foreground">
                          worn by the model
                        </span>
                      ) : null}
                    </th>
                    <td className="px-3 py-2.5 tabular-nums text-foreground">
                      {range(row.chest)}
                    </td>
                    <td className="px-3 py-2.5 tabular-nums text-foreground">
                      {range(row.waist)}
                    </td>
                    <td className="px-3 py-2.5 tabular-nums text-foreground">
                      {show(row.sleeve)}
                    </td>
                  </tr>
                )
              })}
            </tbody>
          </table>
        </div>

        <p className="mt-4 flex items-start gap-1.5 text-xs text-muted-foreground">
          <Info aria-hidden className="mt-0.5 h-3.5 w-3.5 shrink-0" />
          Between two sizes on chest and waist? This shirt is cut straight, so
          take the larger — that is what the exchanges above did.
        </p>
      </div>
    </section>
  )
}

Before you paste

  • Styling is Tailwind utility classes on semantic tokens (bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.
  • Install: npm i lucide-react
  • Every prop has a default, so it renders standalone before you wire it up.

Where it goes

Drop it at components/product-size-guide.tsx and import it where you need the section:

import { ProductSizeGuide } from '@/components/product-size-guide'

Customize

2 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.

Props

Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.

PropTypeDefault
productNamestring'Heavyweight Oxford Shirt'
rowsSizeRow[]DEFAULT_ROWS
modelNotestring'The model is 1.78m and wears a medium.'
fitNoteFrom returns data — the single most useful line on the panel.string—
classNamestring''

Not using React?

The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.

This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.

product-size-guide.html
<!--
  Size Guide — markup from the Hoverlab catalog.

  This is the block rendered once to HTML and wrapped as a component
  file. It is not a port of the React source: the Tailwind classes carry
  the design, which is the part that took the work, and they are the same
  in every framework.

  This block is interactive in React and the handlers are NOT here.
  Buttons, toggles and menus render in their initial state and do
  nothing until you wire them up.
-->
<section class="mx-auto w-full max-w-3xl px-4 py-16 sm:px-6 ">
  <div class="rounded-2xl border border-border bg-card p-5 sm:p-6">
    <div class="flex flex-wrap items-start justify-between gap-3">
      <div>
        <h2 class="flex items-center gap-2 text-base font-semibold text-foreground"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-ruler h-4 w-4 text-muted-foreground" aria-hidden="true"><path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"></path><path d="m14.5 12.5 2-2"></path><path d="m11.5 9.5 2-2"></path><path d="m8.5 6.5 2-2"></path><path d="m17.5 15.5 2-2"></path></svg>Size guide — Heavyweight Oxford Shirt</h2>
        <p class="mt-1 text-xs text-muted-foreground">Measurements are of the body, not the garment.</p>
      </div>
      <fieldset class="shrink-0">
        <legend class="sr-only">Units</legend>
        <div class="flex rounded-lg border border-border bg-background p-0.5">
          <label class="cursor-pointer rounded-md px-3 py-1 text-sm font-medium transition focus-within:ring-2 focus-within:ring-ring bg-primary text-primary-foreground"><input type="radio" class="sr-only" name="size-guide-unit" checked="" value="cm" />Centimetres</label>
          <label class="cursor-pointer rounded-md px-3 py-1 text-sm font-medium transition focus-within:ring-2 focus-within:ring-ring text-muted-foreground hover:text-foreground"><input type="radio" class="sr-only" name="size-guide-unit" value="in" />Inches</label>
        </div>
      </fieldset>
    </div>
    <div class="mt-4 grid gap-2 sm:grid-cols-2">
      <p class="rounded-xl border border-border bg-muted/50 px-3 py-2 text-sm text-foreground">The model is 1.78m and wears a medium.</p>
      <p class="rounded-xl border border-border bg-muted/50 px-3 py-2 text-sm text-foreground">9 in 10 buyers kept their usual size. The 1 in 10 who exchanged went up, not down.</p>
    </div>
    <div class="mt-5 -mx-1 overflow-x-auto px-1">
      <table class="w-full min-w-[34rem] border-collapse text-start text-sm">
        <caption class="sr-only">Body measurements by size, in centimetres.</caption>
        <thead>
          <tr class="border-b border-border">
            <th scope="col" class="sticky start-0 z-10 bg-card px-3 py-2 text-xs font-medium text-muted-foreground">Size</th>
            <th scope="col" class="px-3 py-2 align-top">
              <span class="block text-xs font-medium text-muted-foreground">Chest (cm)</span>
              <span class="mt-0.5 block max-w-44 text-[11px] font-normal leading-snug text-muted-foreground">Around the fullest part, under the arms, tape level and not pulled tight.</span>
            </th>
            <th scope="col" class="px-3 py-2 align-top">
              <span class="block text-xs font-medium text-muted-foreground">Waist (cm)</span>
              <span class="mt-0.5 block max-w-44 text-[11px] font-normal leading-snug text-muted-foreground">Around the narrowest part, usually just above the navel.</span>
            </th>
            <th scope="col" class="px-3 py-2 align-top">
              <span class="block text-xs font-medium text-muted-foreground">Sleeve (cm)</span>
              <span class="mt-0.5 block max-w-44 text-[11px] font-normal leading-snug text-muted-foreground">From the centre back of the neck, over the shoulder, to the wrist.</span>
            </th>
          </tr>
        </thead>
        <tbody class="divide-y divide-border">
          <tr>
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-card">XS</th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">81–86</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">66–71</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">61</td>
          </tr>
          <tr>
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-card">S</th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">86–91</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">71–76</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">63</td>
          </tr>
          <tr class="bg-accent/50">
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-accent/50">M<span class="block text-[11px] font-normal text-muted-foreground">worn by the model</span></th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">96–101</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">81–86</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">64</td>
          </tr>
          <tr>
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-card">L</th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">106–111</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">91–96</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">66</td>
          </tr>
          <tr>
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-card">XL</th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">116–121</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">101–106</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">67</td>
          </tr>
          <tr>
            <th scope="row" class="sticky start-0 z-10 px-3 py-2.5 font-semibold text-foreground bg-card">XXL</th>
            <td class="px-3 py-2.5 tabular-nums text-foreground">126–131</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">111–116</td>
            <td class="px-3 py-2.5 tabular-nums text-foreground">69</td>
          </tr>
        </tbody>
      </table>
    </div>
    <p class="mt-4 flex items-start gap-1.5 text-xs text-muted-foreground"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info mt-0.5 h-3.5 w-3.5 shrink-0" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><path d="M12 16v-4"></path><path d="M12 8h.01"></path></svg>Between two sizes on chest and waist? This shirt is cut straight, so take the larger — that is what the exchanges above did.</p>
  </div>
</section>
  • This is rendered HTML, not a translation of the React source. The Tailwind classes carry the design and work in any framework.
  • It is one frame: the component in its initial state, with no props applied beyond the defaults.
  • This block is interactive in React — toggles, menus or form state. None of that survives here; the markup is the closed/default state and the handlers are gone. Re-wire them in your own framework.
  • Requires Tailwind, and the design tokens the classes reference (bg-card, text-muted-foreground, and so on). The template ZIPs ship a globals.css that defines them.

What each framework gets across the whole catalog — effects convert properly; this rung is markup.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

Used in these pages

Want the whole screen instead of this one section? Open a page and copy it entire.

6 more blocks in Product Detail

All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.

Browse Product Detail

Shipping one commercially

Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.

  • A commercial licence for everything in the catalog
  • Unlimited bundle exports, in Vue, Svelte and Tailwind
  • One payment — no subscription, nothing to renew
Pro — $79 once

More Product Detail blocks

View category
Open the full page for this block

Variant & Add-to-Cart Box

Price, variant radiogroup, quantity stepper and add-to-bag — with sold-out sizes disabled and visible rather than hidden.

Product Detail347 lines1 dep
Open the full page for this block

Product Details Accordion

Description, materials, delivery and returns in named <details> elements — no JavaScript, and the copy stays indexable while collapsed.

Product Detail156 lines1 dep
Open the full page for this block

Rating Distribution Summary

Average rating with a clickable histogram — because a 4.3 of forties and fives is a different product from a 4.3 of ones and fives.

Product Detail126 lines1 dep
Open the full page for this block

Product Spec Split

The specification table beside the product image, with the two or three figures that decide the purchase pulled out of it.

Product Detail159 linesNo deps
Open the full page for this block

Back In Stock Form

The capture that replaces a dead sold-out button, with the honest caveat that a notification is not a reservation.

Product Detail177 linesNo deps