Size Fit Picker

Converts UK, US, EU and IN sizes live and catches a usual size clicked in the wrong system, like US 8 picked as UK 8.

StopsWrong shoe or clothing size ordered

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/size-fit-picker.json

The files land in your project. They're yours to edit.

Usage

size-fit-picker-usage.tsx
import { MENS_SHOES, SizeFitPicker, WOMENS_CLOTHING } from "@/components/ui/size-fit-picker"

<SizeFitPicker
  key="shoes"
  chart={MENS_SHOES}
  brand="Nike"
  usual={{ size: "8", system: "UK", brand: "Nike" }}
  defaultSystem="US"
  value={shoe}
  onValueChange={setShoe}
  available={["5", "6", "7", "8", "9", "10", "12"]}
/>

What it catches

  • The usual size number picked in the wrong system
  • Brand fit offsets (runs small or large)
  • Switching display systems without changing the pick
  • Sizes without an equivalent in a system

Props

SizeFitPicker props
PropTypeDefault
chart

The size chart. Ships with MENS_SHOES, WOMENS_SHOES and WOMENS_CLOTHING.

SizeChartMENS_SHOES
value

The selected size, written in `valueSystem` (what your stock uses).

string | null—
defaultValue

Starting size when uncontrolled, in valueSystem.

string | nullnull
onValueChange

Called with the size in `valueSystem` and its full row.

(size: string, row: SizeRow) => void—
valueSystem

The system your SKUs and `value` use. Switching the shown system never changes the pick.

SizeSystem"UK"
system

The system the sizes are shown in, controlled.

SizeSystem—
defaultSystem

Initial shown system. Defaults to the shopper's usual system, then `valueSystem`.

SizeSystem—
onSystemChange

Called when the shown size system changes.

(system: SizeSystem) => void—
systems

Systems offered as tabs.

SizeSystem[]["UK", "US", "EU", "IN"]
available

Sizes in stock, in `valueSystem`. Others show as sold out. Omit when everything is in stock.

string[]—
usual

The shopper's remembered size, e.g. from past orders: `{ size: "8", system: "UK", brand: "Nike" }`. Pass `chart` when it came from a different chart (men's vs women's) to convert it by foot length.

{ size: string; system: SizeSystem; brand?: string; chart?: SizeChart }—
brand

This product's brand, so a usual size from the same brand isn't adjusted.

string—
fitOffset

How this product fits compared with a usual size from another brand: 1 means size up one, -1 size down.

number0
messages

Reword or translate any sentence.

Partial<typeof SIZE_FIT_PICKER_MESSAGES>—

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Fieldset labelled by its legend
  • System and size pickers are radiogroups with arrow, Home and End keys
  • Suggestion is a labelled button

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Ships with typical men's shoe, women's shoe and women's clothing charts; brands vary
  • Fit offsets come from your data

Rules

Rules not yet verified against an official source.

Built-in size charts are general conversions, not an official standard; not verified against a primary source. Use your brand's own chart. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Wrong shoe or clothing size ordered

Also known as

size chart · size guide · shoe size · uk us eu in · fit · myntra · ecommerce · product page

Field type

Dependencies

Pairs well with