Variant Picker 3
The swatch book: a magazine spread that sells a furnishing by touch. The left page shows the product in the chosen
Use it in a prompt
Use offer/variant-picker-3 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/variant-picker-3.tsx. - Import it and pass your copy and images (Props tab):
import { VariantPicker3 } from "@/components/funneldna/offer/variant-picker-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/variant-picker-3/component.tsx 615 lines
// layout: magazine-spread
// The swatch book: a magazine spread that sells a furnishing by touch. The left page shows the product in the chosen
// fabric, and the facing page lays the fabrics out as close-up swatches. Picking one crossfades the photo and the price.
import * as React from 'react'
import { Check, CircleAlert, ShieldCheck } from 'lucide-react'
import { FX_HOST, Texture } from '../fx/fx'
import linen from '../fx/textures/linen'
import weave from '../fx/textures/weave'
export type FabricVariant = {
id: string
label: string
/** One line on feel and care, shown under the swatch. */
feel?: string
/** Larger sensory line set under the photo while this fabric is chosen. Falls back to feel. */
pull?: string
/** The product photographed in this fabric (slots item-1 … item-n). Keep the framing the same for every fabric. */
image?: string
imageAlt?: string
/** A close-up of the cloth for the swatch. Without it, the swatch zooms into the product photo. */
swatchImage?: string
/** Where the swatch zooms into the product photo (CSS position). Default 50% 60%. */
swatchFocus?: string
/** How far the swatch zooms into the product photo. Default 2.4. */
swatchZoom?: number
/** Colour of the cloth when there is no photo. Product data, written as var(--fabric-x, colour). */
swatch?: string
/** Overrides the shared price for this fabric. */
price?: string
/** Sold out: shown, but it can’t be chosen. */
disabled?: boolean
/** Replaces the sold-out chip text for this fabric. */
statusLabel?: string
}
export type VariantPicker3Copy = {
/** Fieldset legend. */
legend: string
/** Shown under the legend while nothing is chosen. Placeholder: {product}. */
hint: string
/** Small line under the pull line. Placeholder: {fabric}. */
shownIn: string
/** Price sentence. Placeholder: {price}, set large. */
priceLine: string
/** Shown when the chosen fabric costs more than the lowest. Placeholders: {diff}, {fabric}. */
diffLine: string
/** Swatch chip for a fabric that costs more. Placeholder: {diff}. */
diffChip: string
/** Main button. Placeholders: {product}, {fabric}. */
label: string
/** Main button while nothing is chosen. Placeholder: {product}. */
labelEmpty: string
/** Chip on a fabric that can’t be ordered. */
unavailable: string
chooseError: string
/** Default photo alt. Placeholders: {name}, {fabric}. */
imageAlt: string
/** Accessible form name. Placeholder: {name}. */
formLabel: string
}
export type VariantPicker3State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type VariantPicker3Props = {
/** Full product name, used in image alts and the form name. */
name?: string
/** Short product name for the button, e.g. Halden. */
shortName?: string
/** Section headline. A string headline gets the highlight phrase set in the accent colour. */
headline?: React.ReactNode
highlight?: string
lead?: string
variants?: FabricVariant[]
/** Pre-selected fabric id. null starts with nothing chosen. */
defaultVariant?: string | null
/** Shared price for every fabric that doesn’t set its own. */
price?: string
/** Small line under the price. */
note?: string
reasonsTitle?: string
/** Short reasons, numbered inline before the price. */
reasons?: string[]
/** One short line under the main button. */
reassurance?: string
/** The secondary samples action shows only when this is supplied. */
samplesLabel?: string
/** Optional destination for the samples action. */
samplesHref?: string
copy?: Partial<VariantPicker3Copy>
disabled?: boolean
state?: VariantPicker3State
/** Receives the chosen fabric when the buyer presses the main button. */
onSubmit?: (variant: FabricVariant) => void
/** Fires when the chosen fabric changes. */
onSelect?: (variant: FabricVariant) => void
/** Fires when the buyer presses the samples action. */
onSamples?: () => void
className?: string
}
export function VariantPicker3(props: VariantPicker3Props) {
const {
name = 'Halden lounge chair',
shortName = 'Halden',
headline = 'Lean in close. Pick the fabric you’ll sink into every evening.',
highlight = 'the fabric you’ll sink into',
lead = 'Every swatch is shot up close, so you see the weave before it’s on your chair. Tap one and the Halden changes with it.',
variants = DEFAULT_VARIANTS,
defaultVariant,
price = '$1,290',
note = 'One payment. Free delivery to your door.',
reasonsTitle = 'Three reasons the Halden costs what it does',
reasons = DEFAULT_REASONS,
reassurance = '30-day returns · Secure checkout',
samplesLabel,
samplesHref,
copy,
disabled: disabledProp = false,
state = 'default',
onSubmit,
onSelect,
onSamples,
className,
} = props
const t = { ...DEFAULT_COPY, ...copy }
const uid = React.useId().replace(/:/g, '')
const titleId = uid + '-title'
const errId = uid + '-err'
const firstAvailable = variants.find((v) => !v.disabled)?.id ?? null
const initial = defaultVariant === undefined ? firstAvailable : defaultVariant
const [selected, setSelected] = React.useState<string | null>(state === 'error' ? null : initial)
const [error, setError] = React.useState(state === 'error')
const gridRef = React.useRef<HTMLDivElement>(null)
React.useEffect(() => {
setSelected(state === 'error' ? null : initial)
setError(state === 'error')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
const current = variants.find((v) => v.id === selected && !v.disabled) ?? null
const shown = current ?? variants.find((v) => !v.disabled) ?? variants[0]
if (!shown) return null
const disabled = disabledProp || state === 'disabled'
const priceOf = (v: FabricVariant) => v.price ?? price
const base = lowest(variants.filter((v) => !v.disabled).map(priceOf))
const extra = (v: FabricVariant) => {
const amount = money(priceOf(v))
return amount !== null && base !== null && amount > base ? amount - base : 0
}
const shownPrice = priceOf(shown)
const shownExtra = extra(shown)
const parts = t.priceLine.split('{price}')
const before = parts.length > 1 ? parts[0].trim() : ''
const after = (parts.length > 1 ? parts.slice(1).join('{price}') : t.priceLine).trim()
const label = current
? fill(t.label, { product: shortName, fabric: current.label })
: fill(t.labelEmpty, { product: shortName })
const altOf = (v: FabricVariant) => v.imageAlt ?? fill(t.imageAlt, { name, fabric: v.label })
const photos = variants.filter((v) => v.image && (!v.disabled || v.id === shown.id))
const pullText = shown.pull ?? shown.feel
const btnClass = ['vp3-btn', state === 'hover' && 'is-hover', state === 'active' && 'is-active']
.filter(Boolean)
.join(' ')
// The reasons sit on the photo page of the spread on wide screens (so the left page never runs empty) and
// between the swatches and the price on phones. Only one copy is ever displayed.
const renderReasons = (where: string) =>
reasons.length ? (
<div className={'vp3-reasons ' + where}>
{reasonsTitle ? <h3 className='vp3-rt'>{reasonsTitle}</h3> : null}
<ol className='vp3-rl'>
{reasons.map((reason, i) => (
<li key={i}>
<span className='vp3-rn' aria-hidden='true'>
{i + 1}
</span>
<span className='vp3-rx'>{reason}</span>
</li>
))}
</ol>
</div>
) : null
function choose(v: FabricVariant) {
if (disabled || v.disabled) return
setSelected(v.id)
setError(false)
onSelect?.(v)
}
function submit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (disabled) return
if (!current) {
setError(true)
gridRef.current?.querySelector<HTMLInputElement>('input:not(:disabled)')?.focus()
return
}
onSubmit?.(current)
}
return (
<section
className={['cf-variant-picker-3', className].filter(Boolean).join(' ')}
style={FX_HOST}
aria-labelledby={titleId}
data-disabled={disabled || undefined}
>
<style>{CSS}</style>
<div className='vp3-bandtex' aria-hidden='true'>
<Texture src={linen} tone='ink' />
</div>
<div className='vp3-wrap'>
<header className='vp3-head'>
<h2 id={titleId} className='vp3-h'>
{markPhrase(headline, highlight)}
</h2>
{lead ? <p className='vp3-lead'>{lead}</p> : null}
</header>
<form className='vp3-spread' onSubmit={submit} noValidate aria-label={fill(t.formLabel, { name })}>
<div className='vp3-left'>
<figure className='vp3-fig'>
<div className='vp3-photo'>
{photos.map((v) => {
const on = v.id === shown.id
return (
<img
key={v.id}
className='vp3-shot'
src={v.image}
alt={on ? altOf(v) : ''}
aria-hidden={on ? undefined : true}
data-on={on || undefined}
width={960}
height={1200}
decoding='async'
/>
)
})}
{shown.image ? null : (
<span className='vp3-shot' data-on='' role='img' aria-label={altOf(shown)}>
<FabricFill colour={shown.swatch} />
</span>
)}
</div>
<figcaption className='vp3-cap'>
{pullText ? (
<span key={shown.id} className='vp3-pull'>
{pullText}
</span>
) : null}
<span className='vp3-shown'>{fill(t.shownIn, { fabric: shown.label })}</span>
</figcaption>
</figure>
{renderReasons('vp3-reasons--spread')}
</div>
<div className='vp3-right'>
<fieldset className='vp3-field' disabled={disabled} aria-describedby={error ? errId : undefined}>
<legend className='vp3-legend'>
{t.legend}
{current ? ': ' : null}
{current ? <span className='vp3-legend-pick'>{current.label}</span> : null}
</legend>
{error ? (
<p id={errId} className='vp3-err' role='alert'>
<CircleAlert className='vp3-ico' size={18} strokeWidth={2.5} aria-hidden />
{t.chooseError}
</p>
) : current ? null : (
<p className='vp3-hint'>{fill(t.hint, { product: shortName })}</p>
)}
<div className='vp3-grid' ref={gridRef} data-invalid={error || undefined}>
{variants.map((v) => {
const on = v.id === current?.id
const more = extra(v)
const chip = v.disabled
? v.statusLabel ?? t.unavailable
: more
? fill(t.diffChip, { diff: formatLike(priceOf(v) ?? '', more) })
: ''
return (
<label key={v.id} className='vp3-sw' data-on={on || undefined} data-off={v.disabled || undefined}>
<input
className='vp3-sr'
type='radio'
name={uid + '-fabric'}
value={v.id}
checked={on}
disabled={v.disabled}
onChange={() => choose(v)}
/>
<span className='vp3-sw-img'>
{v.swatchImage ? (
<img src={v.swatchImage} alt='' width={480} height={480} decoding='async' />
) : v.image ? (
<img
className='is-crop'
src={v.image}
alt=''
width={480}
height={600}
decoding='async'
style={
{
'--vp3-focus': v.swatchFocus ?? '50% 60%',
'--vp3-zoom': v.swatchZoom ?? 2.4,
} as React.CSSProperties
}
/>
) : (
<FabricFill colour={v.swatch} />
)}
<span className='vp3-tick' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
</span>
<span className='vp3-sw-top'>
<span className='vp3-sw-name'>{v.label}</span>
{chip ? <span className='vp3-sw-chip'>{chip}</span> : null}
</span>
{v.feel ? <span className='vp3-sw-feel'>{v.feel}</span> : null}
</label>
)
})}
</div>
{shown.feel ? (
<p className='vp3-detail'>
<strong>{shown.label}.</strong> {shown.feel}
</p>
) : null}
</fieldset>
{renderReasons('vp3-reasons--flow')}
<div className='vp3-order'>
{shownPrice ? (
<p className='vp3-price' aria-live='polite'>
{before ? <span className='vp3-after'>{before}</span> : null}
<span key={shownPrice} className='vp3-amt'>
{shownPrice}
</span>
{after ? <span className='vp3-after'>{after}</span> : null}
</p>
) : null}
{shownExtra ? (
<p className='vp3-diff'>
{fill(t.diffLine, { diff: formatLike(shownPrice ?? '', shownExtra), fabric: shown.label })}
</p>
) : null}
{note ? <p className='vp3-note'>{note}</p> : null}
<button type='submit' className={btnClass} disabled={disabled}>
{label}
</button>
{reassurance ? (
<p className='vp3-assure'>
<ShieldCheck className='vp3-ico' size={16} strokeWidth={2.5} aria-hidden />
{reassurance}
</p>
) : null}
{samplesLabel ? (
samplesHref ? (
<a
className='vp3-sec'
href={disabled ? undefined : samplesHref}
aria-disabled={disabled || undefined}
onClick={() => {
if (!disabled) onSamples?.()
}}
>
{samplesLabel}
</a>
) : (
<button type='button' className='vp3-sec' disabled={disabled} onClick={() => onSamples?.()}>
{samplesLabel}
</button>
)
) : null}
</div>
</div>
</form>
</div>
</section>
)
}
export default VariantPicker3
function FabricFill({ colour }: { colour?: string }) {
return (
<span className='vp3-fill' style={{ ...FX_HOST, '--vp3-sw': colour } as React.CSSProperties}>
<Texture src={weave} tone='band-ink' />
</span>
)
}
function markPhrase(headline: React.ReactNode, phrase?: string): React.ReactNode {
if (typeof headline !== 'string' || !phrase) return headline
const at = headline.indexOf(phrase)
if (at < 0) return headline
return (
<>
{headline.slice(0, at)}
<span className='vp3-mark'>{phrase}</span>
{headline.slice(at + phrase.length)}
</>
)
}
function fill(template: string, values: Record<string, string>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (whole: string, key: string) => (key in values ? values[key] : whole))
}
function money(value?: string): number | null {
if (!value) return null
const found = value.replace(/,/g, '').match(/[0-9]+(?:[.][0-9]+)?/)
return found ? parseFloat(found[0]) : null
}
function lowest(values: (string | undefined)[]): number | null {
const amounts = values.map((v) => money(v)).filter((n): n is number => n !== null)
return amounts.length ? Math.min(...amounts) : null
}
function formatLike(sample: string, amount: number) {
const prefix = (sample.match(/^[^0-9]*/)?.[0] ?? '').trim()
const decimals = /[.][0-9]/.test(sample) ? 2 : 0
return prefix + amount.toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals })
}
const DEFAULT_COPY: VariantPicker3Copy = {
legend: 'Pick your fabric',
hint: 'Tap a swatch to see it on the {product}.',
shownIn: 'Shown in {fabric}',
priceLine: '{price} today. That’s it.',
diffLine: 'Includes {diff} for the {fabric}.',
diffChip: '+{diff}',
label: 'Yes! I want the {product}',
labelEmpty: 'Yes! I want the {product}',
unavailable: 'Sold out',
chooseError: 'Pick a fabric so we know what to upholster.',
imageAlt: '{name} in {fabric}',
formLabel: 'Choose a fabric for the {name}',
}
const DEFAULT_REASONS = [
'A kiln-dried oak frame, joined by hand, that won’t wobble or creak.',
'Feather-wrapped cushions that keep their shape year after year.',
'Covers that zip off, so a spill means a wash, not a new chair.',
]
const DEFAULT_VARIANTS: FabricVariant[] = [
{
id: 'oat-boucle',
label: 'Oat bouclé',
feel: 'Nubby loops, soft as a sweater. Spot clean with a damp cloth.',
pull: 'Run a hand across it and the loops spring right back.',
price: '$1,290',
swatch: 'var(--fabric-oat, #d9cbb3)',
},
{
id: 'moss-velvet',
label: 'Moss velvet',
feel: 'Deep, cool pile that shifts in the light. Brush to refresh.',
pull: 'Sink in and the velvet warms to you in seconds.',
price: '$1,390',
swatch: 'var(--fabric-moss, #4f5d3a)',
},
{
id: 'rust-wool',
label: 'Rust wool',
feel: 'Dense, warm weave that hides crumbs and paws. Vacuum weekly.',
pull: 'A tight wool weave that looks better every winter.',
price: '$1,290',
swatch: 'var(--fabric-rust, #9c4a2c)',
},
{
id: 'ink-linen',
label: 'Ink linen',
feel: 'Crisp, cool slub with a relaxed drape. Dry clean only.',
swatch: 'var(--fabric-ink-linen, #2c3442)',
disabled: true,
},
]
const CSS = `
.cf-variant-picker-3{--vp3-ease:cubic-bezier(.2,.7,.2,1);--vp3-sh:var(--shadow,oklch(0.22 0.03 260));--vp3-focus-ring:oklch(from var(--field-focus,var(--accent)) l c h / .55);position:relative;isolation:isolate;overflow-x:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
.cf-variant-picker-3 *,.cf-variant-picker-3 *::before,.cf-variant-picker-3 *::after{box-sizing:border-box}
.cf-variant-picker-3 .vp3-bandtex{position:absolute;inset:0;z-index:0;display:none;overflow:hidden;pointer-events:none}
.cf-variant-picker-3 .vp3-wrap{position:relative;z-index:1;max-width:1120px;margin:0 auto}
.cf-variant-picker-3 .vp3-head{max-width:820px;margin:0 0 clamp(32px,4vw,48px)}
.cf-variant-picker-3 .vp3-h{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:var(--display-tracking,-0.025em);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--ink);text-wrap:balance}
.cf-variant-picker-3 .vp3-mark{color:var(--accent)}
.cf-variant-picker-3 .vp3-lead{max-width:60ch;margin:16px 0 0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-variant-picker-3 .vp3-spread{--vp3-page:var(--surface);--vp3-well:color-mix(in oklch,var(--ink) 4%,var(--vp3-page));position:relative;display:grid;gap:32px;margin:0}
.cf-variant-picker-3 .vp3-left,.cf-variant-picker-3 .vp3-right{position:relative;min-width:0}
.cf-variant-picker-3 .vp3-fig{margin:0}
.cf-variant-picker-3 .vp3-photo{position:relative;aspect-ratio:1/1;overflow:hidden;border-radius:12px;background:color-mix(in oklch,var(--ink) 6%,var(--vp3-page))}
.cf-variant-picker-3 .vp3-shot{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:50% 55%;opacity:0}
.cf-variant-picker-3 .vp3-shot[data-on]{opacity:1}
.cf-variant-picker-3 .vp3-fill{display:block;width:100%;height:100%;background:var(--vp3-sw,color-mix(in oklch,var(--ink) 12%,var(--vp3-page)))}
.cf-variant-picker-3 .vp3-cap{display:grid;gap:12px;margin-top:20px}
.cf-variant-picker-3 .vp3-pull{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance}
.cf-variant-picker-3 .vp3-shown{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted)}
.cf-variant-picker-3 .vp3-field{min-width:0;margin:0;padding:0;border:0}
.cf-variant-picker-3 .vp3-legend{float:left;width:100%;margin:0 0 12px;padding:0;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance}
.cf-variant-picker-3 .vp3-legend-pick{color:var(--accent)}
.cf-variant-picker-3 .vp3-hint,.cf-variant-picker-3 .vp3-err{clear:both;margin:0 0 16px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.cf-variant-picker-3 .vp3-err{font-weight:700;color:var(--danger)}
.cf-variant-picker-3 .vp3-ico{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-variant-picker-3 .vp3-grid{clear:both;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 8px}
.cf-variant-picker-3 .vp3-sw{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;padding:8px 8px 12px;border-radius:12px;cursor:pointer}
.cf-variant-picker-3 .vp3-sw[data-on]{background:color-mix(in oklch,var(--accent) 10%,var(--vp3-page))}
.cf-variant-picker-3 .vp3-sw:has(.vp3-sr:focus-visible){outline:3px solid var(--vp3-focus-ring);outline-offset:2px}
.cf-variant-picker-3 .vp3-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.cf-variant-picker-3 .vp3-sw-img{position:relative;display:block;aspect-ratio:4/3;overflow:hidden;border-radius:8px;background:color-mix(in oklch,var(--ink) 6%,var(--vp3-page));outline:3px solid transparent;outline-offset:2px}
.cf-variant-picker-3 .vp3-sw[data-on] .vp3-sw-img{outline-color:var(--accent)}
.cf-variant-picker-3 .vp3-grid[data-invalid] .vp3-sw:not([data-off]) .vp3-sw-img{outline-color:oklch(from var(--danger) l c h / .6)}
.cf-variant-picker-3 .vp3-sw-img img{display:block;width:100%;height:100%;object-fit:cover}
.cf-variant-picker-3 .vp3-sw-img img.is-crop{object-position:var(--vp3-focus,50% 60%);transform-origin:var(--vp3-focus,50% 60%);transform:scale(var(--vp3-zoom,2.4))}
.cf-variant-picker-3 .vp3-tick{position:absolute;top:8px;right:8px;display:grid;place-items:center;width:28px;height:28px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));box-shadow:var(--shadow-sm,0 1px 2px oklch(from var(--vp3-sh) l c h / .3));opacity:0}
.cf-variant-picker-3 .vp3-sw[data-on] .vp3-tick{opacity:1}
.cf-variant-picker-3 .vp3-sw[data-off],.cf-variant-picker-3[data-disabled] .vp3-sw{cursor:not-allowed}
.cf-variant-picker-3 .vp3-sw[data-off] .vp3-sw-img>:not(.vp3-tick){filter:grayscale(.85);opacity:.55}
.cf-variant-picker-3 .vp3-sw[data-off] .vp3-tick{display:none}
.cf-variant-picker-3 .vp3-sw-top{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;min-height:28px;padding:0 4px}
.cf-variant-picker-3 .vp3-sw-name{min-width:0;font-family:var(--font-display);font-weight:800;font-size:.9375rem;line-height:1.2;color:var(--ink);text-wrap:balance;overflow-wrap:anywhere}
.cf-variant-picker-3 .vp3-sw[data-off] .vp3-sw-name{color:var(--muted)}
.cf-variant-picker-3 .vp3-sw-chip{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 7%,var(--vp3-page));color:var(--ink);font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap;font-variant-numeric:tabular-nums}
.cf-variant-picker-3 .vp3-sw-feel{display:none;padding:0 4px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-variant-picker-3 .vp3-sw[data-on] .vp3-sw-feel{color:var(--ink)}
.cf-variant-picker-3 .vp3-detail{margin:16px 0 0;font-size:1.0625rem;line-height:1.5;color:var(--ink);text-wrap:pretty}
.cf-variant-picker-3 .vp3-detail strong{font-weight:800}
.cf-variant-picker-3 .vp3-reasons{margin-top:32px}
.cf-variant-picker-3 .vp3-reasons--spread{display:none}
.cf-variant-picker-3 .vp3-rt{margin:0 0 16px;font-family:var(--font-display);font-weight:800;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.3;letter-spacing:-0.005em;color:var(--ink);text-wrap:balance}
.cf-variant-picker-3 .vp3-rl{display:grid;gap:16px;margin:0;padding:0;list-style:none;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink)}
.cf-variant-picker-3 .vp3-rl li{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:baseline;gap:12px}
.cf-variant-picker-3 .vp3-rn{font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;font-variant-numeric:tabular-nums;color:var(--accent)}
.cf-variant-picker-3 .vp3-rx{min-width:0;text-wrap:pretty}
.cf-variant-picker-3 .vp3-order{margin-top:24px;padding:clamp(20px,3vw,28px);border-radius:12px;background:var(--vp3-well)}
.cf-variant-picker-3 .vp3-price{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin:0;color:var(--ink)}
.cf-variant-picker-3 .vp3-amt{display:inline-block;font-family:var(--font-display);font-weight:800;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-variant-picker-3 .vp3-after{font-family:var(--font-display);font-weight:800;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.2}
.cf-variant-picker-3 .vp3-diff{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:700;color:var(--ink)}
.cf-variant-picker-3 .vp3-note{margin:8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted)}
.cf-variant-picker-3 .vp3-price+.vp3-note{margin-top:12px}
.cf-variant-picker-3 .vp3-btn{--vp3-bg:var(--button-bg,var(--cta));--vp3-bg2:var(--button-bg-2,var(--cta-2));display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;margin-top:24px;padding:14px clamp(20px,4vw,28px);border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--vp3-bg) calc(l + .04) c h),oklch(from var(--vp3-bg2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--vp3-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--vp3-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--vp3-sh) l c h / .3),0 8px 16px -6px oklch(from var(--vp3-sh) l c h / .35))}
.cf-variant-picker-3 .vp3-btn:hover:not(:disabled),.cf-variant-picker-3 .vp3-btn.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--vp3-bg) calc(l - .01) c h),oklch(from var(--vp3-bg2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--vp3-bg) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--vp3-bg) calc(l - .2) c h),0 1px 2px oklch(from var(--vp3-sh) l c h / .32),0 12px 20px -8px oklch(from var(--vp3-sh) l c h / .42))}
.cf-variant-picker-3 .vp3-btn:active:not(:disabled),.cf-variant-picker-3 .vp3-btn.is-active:not(:disabled){background:linear-gradient(oklch(from var(--vp3-bg) calc(l - .06) c h),oklch(from var(--vp3-bg2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--vp3-sh) l c h / .35),inset 0 -2px 0 oklch(from var(--vp3-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--vp3-sh) l c h / .25)}
.cf-variant-picker-3 .vp3-btn:focus-visible{outline:3px solid var(--vp3-focus-ring);outline-offset:3px}
.cf-variant-picker-3 .vp3-btn:disabled{background:var(--secondary);color:var(--secondary-ink);text-shadow:none;box-shadow:none;cursor:not-allowed}
.cf-variant-picker-3 .vp3-assure{margin:12px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.cf-variant-picker-3 .vp3-sec{display:flex;align-items:center;justify-content:center;width:100%;min-height:56px;margin-top:16px;padding:12px 24px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:1.0625rem;line-height:1.2;text-align:center;text-decoration:none;text-wrap:balance;cursor:pointer}
.cf-variant-picker-3 .vp3-sec:hover:not(:disabled):not([aria-disabled]){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .03) c h)}
.cf-variant-picker-3 .vp3-sec:focus-visible{outline:3px solid var(--vp3-focus-ring);outline-offset:3px}
.cf-variant-picker-3 .vp3-sec:disabled,.cf-variant-picker-3 .vp3-sec[aria-disabled]{cursor:not-allowed}
@keyframes vp3-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes vp3-pop{from{transform:scale(.94)}to{transform:none}}
@media (hover:hover){
.cf-variant-picker-3 .vp3-sw:not([data-off]):hover{background:var(--vp3-well)}
.cf-variant-picker-3 .vp3-sw[data-on]:hover{background:color-mix(in oklch,var(--accent) 10%,var(--vp3-page))}
.cf-variant-picker-3[data-disabled] .vp3-sw:not([data-on]):hover{background:transparent}
}
@media (min-width:640px){
.cf-variant-picker-3 .vp3-photo{aspect-ratio:4/3}
.cf-variant-picker-3 .vp3-grid{gap:16px 12px}
.cf-variant-picker-3 .vp3-sw-name{font-size:clamp(1.0625rem,1.25vw,1.125rem)}
.cf-variant-picker-3 .vp3-sw-feel{display:block}
.cf-variant-picker-3 .vp3-detail{display:none}
}
@media (min-width:720px){
.cf-variant-picker-3 .vp3-bandtex{display:block}
.cf-variant-picker-3 .vp3-spread{--vp3-page:var(--card);padding:clamp(20px,3vw,32px);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));background:var(--card);box-shadow:var(--card-shadow,var(--shadow-md))}
}
@media (min-width:960px){
.cf-variant-picker-3 .vp3-spread{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0;padding:0}
.cf-variant-picker-3 .vp3-spread::before{content:'';position:absolute;top:0;bottom:0;left:50%;z-index:0;width:36px;transform:translateX(-50%);background:linear-gradient(90deg,transparent,oklch(from var(--vp3-sh) l c h / .06) 40%,oklch(from var(--vp3-sh) l c h / .14) 50%,oklch(from var(--vp3-sh) l c h / .06) 60%,transparent);pointer-events:none}
.cf-variant-picker-3 .vp3-left{position:sticky;top:24px;align-self:start;padding:clamp(28px,3vw,40px)}
.cf-variant-picker-3 .vp3-right{padding:clamp(28px,3vw,40px)}
.cf-variant-picker-3 .vp3-photo{aspect-ratio:4/5}
.cf-variant-picker-3 .vp3-sw-img{aspect-ratio:5/4}
.cf-variant-picker-3 .vp3-reasons--spread{display:block;margin-top:40px}
.cf-variant-picker-3 .vp3-reasons--flow{display:none}
.cf-variant-picker-3 .vp3-order{margin-top:32px}
}
@media (prefers-reduced-motion:no-preference){
.cf-variant-picker-3 .vp3-shot{transform:scale(1.03);transition:opacity .55s var(--vp3-ease),transform .9s var(--vp3-ease)}
.cf-variant-picker-3 .vp3-shot[data-on]{transform:none}
.cf-variant-picker-3 .vp3-pull{animation:vp3-rise .45s var(--vp3-ease) both}
.cf-variant-picker-3 .vp3-amt{animation:vp3-pop .3s var(--vp3-ease) both}
.cf-variant-picker-3 .vp3-sw{transition:background-color .16s ease,transform .16s ease}
.cf-variant-picker-3 .vp3-sw-img{transition:outline-color .16s ease}
.cf-variant-picker-3 .vp3-sw-img img{transition:transform .5s var(--vp3-ease)}
.cf-variant-picker-3 .vp3-tick{transform:scale(.9);transition:opacity .2s ease,transform .3s var(--vp3-ease)}
.cf-variant-picker-3 .vp3-sw[data-on] .vp3-tick{transform:none}
.cf-variant-picker-3 .vp3-btn,.cf-variant-picker-3 .vp3-sec{transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-variant-picker-3 .vp3-btn:hover:not(:disabled),.cf-variant-picker-3 .vp3-btn.is-hover:not(:disabled){transform:translateY(-1px)}
.cf-variant-picker-3 .vp3-btn:active:not(:disabled),.cf-variant-picker-3 .vp3-btn.is-active:not(:disabled){transform:translateY(1px)}
.cf-variant-picker-3 .vp3-sec:active:not(:disabled):not([aria-disabled]){transform:translateY(1px)}
}
@media (hover:hover) and (prefers-reduced-motion:no-preference){
.cf-variant-picker-3 .vp3-sw:not([data-off]):hover{transform:translateY(-2px)}
.cf-variant-picker-3 .vp3-sw:not([data-off]):hover .vp3-sw-img img{transform:scale(1.08)}
.cf-variant-picker-3 .vp3-sw:not([data-off]):hover .vp3-sw-img img.is-crop{transform:scale(calc(var(--vp3-zoom,2.4) * 1.08))}
.cf-variant-picker-3[data-disabled] .vp3-sw:hover{transform:none}
.cf-variant-picker-3[data-disabled] .vp3-sw:hover .vp3-sw-img img{transform:none}
.cf-variant-picker-3[data-disabled] .vp3-sw:hover .vp3-sw-img img.is-crop{transform:scale(var(--vp3-zoom,2.4))}
}
`
pieces/offer/variant-picker-3/specimen.tsx 66 lines
import __studioImage54507312 from "../assets/c4c2d2c1239d323d.webp";
import __studioImageb08c8b19 from "../assets/1cc8d0fe3705f5dd.webp";
import __studioImage15c192a2 from "../assets/15bb52a65d1af196.webp";
// Specimen: the Halden lounge chair swatch book, with three photographed fabrics and one sold out.
import * as React from 'react'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { VariantPicker3, type FabricVariant, type VariantPicker3State } from '../variant-picker-3'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function VariantPicker3Specimen({ state = 'default' }: { state?: VariantPicker3State }) {
const variants: FabricVariant[] = [
{
id: 'oat-boucle',
label: 'Oat bouclé',
feel: 'Nubby loops, soft as a sweater. Spot clean with a damp cloth.',
pull: 'Run a hand across it and the loops spring right back.',
price: '$1,290',
image: slot('item-1', __studioImage54507312),
imageAlt: 'Halden lounge chair in oat bouclé on a light oak frame',
swatchFocus: '50% 60%',
swatchZoom: 2.4,
},
{
id: 'moss-velvet',
label: 'Moss velvet',
feel: 'Deep, cool pile that shifts in the light. Brush to refresh.',
pull: 'Sink in and the velvet warms to you in seconds.',
price: '$1,390',
image: slot('item-2', __studioImageb08c8b19),
imageAlt: 'Halden lounge chair in moss green velvet on a light oak frame',
swatchFocus: '50% 60%',
swatchZoom: 2.4,
},
{
id: 'rust-wool',
label: 'Rust wool',
feel: 'Dense, warm weave that hides crumbs and paws. Vacuum weekly.',
pull: 'A tight wool weave that looks better every winter.',
price: '$1,290',
image: slot('item-3', __studioImage15c192a2),
imageAlt: 'Halden lounge chair in rust wool on a light oak frame',
swatchFocus: '50% 60%',
swatchZoom: 2.4,
},
{
id: 'ink-linen',
label: 'Ink linen',
feel: 'Crisp, cool slub with a relaxed drape. Dry clean only.',
price: '$1,290',
swatch: 'var(--fabric-ink-linen, #2c3442)',
disabled: true,
},
]
return (
<VariantPicker3
variants={variants}
reassurance={defaults.sample.guarantee + ' · Secure checkout'}
samplesLabel='Order free fabric samples'
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
name OptionalVariantPicker3 |
string |
|
shortName OptionalVariantPicker3 |
string |
|
headline OptionalVariantPicker3 |
React.ReactNode |
|
highlight OptionalVariantPicker3 |
string |
|
lead OptionalVariantPicker3 |
string |
|
variants OptionalVariantPicker3 |
FabricVariant[] |
|
defaultVariant OptionalVariantPicker3 |
string | null |
|
price OptionalVariantPicker3 |
string |
|
note OptionalVariantPicker3 |
string |
|
reasonsTitle OptionalVariantPicker3 |
string |
|
reasons OptionalVariantPicker3 |
string[] |
|
reassurance OptionalVariantPicker3 |
string |
|
samplesLabel OptionalVariantPicker3 |
string |
|
samplesHref OptionalVariantPicker3 |
string |
|
copy OptionalVariantPicker3 |
Partial<VariantPicker3Copy> |
|
disabled OptionalVariantPicker3 |
boolean |
|
state OptionalVariantPicker3 |
VariantPicker3State |
|
onSubmit OptionalVariantPicker3 |
(variant: FabricVariant) => void |
|
onSelect OptionalVariantPicker3 |
(variant: FabricVariant) => void |
|
onSamples OptionalVariantPicker3 |
() => void |
|
className OptionalVariantPicker3 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
15bb52a65d1af196.webp
image/webp · 70.5 KB
-
1cc8d0fe3705f5dd.webp
image/webp · 38.4 KB
-
2c539f422023a290.webp
image/webp · 115 KB
-
4137412454b17370.webp
image/webp · 94.8 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
c4c2d2c1239d323d.webp
image/webp · 123 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB