Product Selector 2
Problem-first product selector: the visitor picks their problem on an angled dark field, and the matched product answers it with one line of why, its price and an Add To Cart button that names it.
Use it in a prompt
Use offer/product-selector-2 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/product-selector-2.tsx. - Import it and pass your copy and images (Props tab):
import { ProductSelector2 } from "@/components/funneldna/offer/product-selector-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-selector-2/component.tsx 404 lines
// layout: diagonal-split
// Problem-first product selector: the visitor picks their problem on an angled dark field, and the matched product answers it with one line of why, its price and an Add To Cart button that names it.
import * as React from 'react'
import { motion, useReducedMotion } from 'motion/react'
import { Check, Info, Lock, ShieldCheck, ShoppingCart, type LucideIcon } from 'lucide-react'
export type ProductSelector2Product = {
id: string
name: string
/** Red subhead that introduces the product as the answer to the problem. */
headline: string
/** One line on why it fits the problem. */
why: string
/** Supplied price, shown exactly as written. */
price: string
/** Supplied breakdown under the price (e.g. One 30-cup tin, about 80¢ a cup). Empty hides it. */
priceBreakdown?: string
/** Product shot, best on a transparent background (object-fit: contain). */
image: string
imageAlt?: string
}
export type ProductSelector2Problem = {
id: string
/** The problem in the visitor’s own words; the tab label. */
label: string
/** One line that restates the problem above the answer. Empty hides it. */
agitate?: string
/** Optional lucide icon shown beside the label. */
icon?: LucideIcon
/** The product that answers this problem; several problems may share one product. */
product: ProductSelector2Product
}
export type ProductSelector2State = 'default' | 'hover' | 'active' | 'disabled'
export type ProductSelector2Props = {
/** 2 to 4 problems, each matched to its product. */
problems: ProductSelector2Problem[]
/** Problem selected first. Defaults to the first problem. */
defaultProblemId?: string
headline?: string
/** One phrase inside the headline shown at full strength. */
headlineEmphasis?: string
lead?: string
/** Accessible name of the problem tab list. */
tabsLabel?: string
/** Button label; {name} is replaced with the matched product name. */
buttonLabel?: string
/** Screen-reader words before the price inside the button and the price block. */
priceLabel?: string
/** Short supplied reassurance lines under the button. */
reassurance?: string[]
disabledNote?: string
disabled?: boolean
/** Checkout destination; renders the button as a link. */
href?: string
/** Studio/demo state driver. */
state?: ProductSelector2State
onSelect?: (problem: ProductSelector2Problem) => void
/** Called with the matched product when the button is pressed. */
onAction?: (product: ProductSelector2Product, problem: ProductSelector2Problem) => void
className?: string
}
const ease = [0.2, 0.7, 0.2, 1] as const
export function ProductSelector2({
problems,
defaultProblemId,
headline = 'Which one sounds like you?',
headlineEmphasis,
lead = '',
tabsLabel = 'Choose the problem you have',
buttonLabel = 'Add {name} To Cart',
priceLabel = 'Price',
reassurance = [],
disabledNote = 'Adding to your cart is unavailable right now.',
disabled = false,
href,
state = 'default',
onSelect,
onAction,
className = '',
}: ProductSelector2Props) {
const list = (problems ?? []).slice(0, 4)
const reduce = useReducedMotion()
const uid = React.useId().replace(/[^a-zA-Z0-9]/g, '')
const tabRefs = React.useRef<Array<HTMLButtonElement | null>>([])
const [activeId, setActiveId] = React.useState<string | undefined>(defaultProblemId ?? list[0]?.id)
const [swapped, setSwapped] = React.useState(false)
if (list.length === 0) return null
const index = Math.max(0, list.findIndex((p) => p.id === activeId))
const active = list[index]
const product = active.product
const isDisabled = disabled || state === 'disabled'
const force = state === 'hover' || state === 'active' ? state : undefined
const demoHover = state === 'hover' && list.length > 1 ? (index + 1) % list.length : -1
const animate = swapped && !reduce
const panelId = `ps2-panel-${uid}`
const tabId = (i: number) => `ps2-tab-${uid}-${i}`
const assureId = `ps2-assure-${uid}`
const noteId = `ps2-note-${uid}`
const showAssure = !isDisabled && reassurance.length > 0
const describedBy = [showAssure ? assureId : '', isDisabled ? noteId : ''].filter(Boolean).join(' ') || undefined
const label = buttonLabel.split('{name}').join(product.name)
const emph = Boolean(headlineEmphasis && headline.includes(headlineEmphasis))
const choose = (i: number) => {
const next = list[i]
if (!next || next.id === active.id) return
setActiveId(next.id)
setSwapped(true)
onSelect?.(next)
}
const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, i: number) => {
const n = list.length
let next = -1
switch (event.key) {
case 'ArrowDown':
case 'ArrowRight':
next = (i + 1) % n
break
case 'ArrowUp':
case 'ArrowLeft':
next = (i - 1 + n) % n
break
case 'Home':
next = 0
break
case 'End':
next = n - 1
break
default:
return
}
event.preventDefault()
choose(next)
tabRefs.current[next]?.focus()
}
const act = () => {
if (!isDisabled) onAction?.(product, active)
}
const inner = (
<>
<ShoppingCart className='ps2-cart' size={20} strokeWidth={2.5} aria-hidden />
<span className='ps2-btn-label'>{label}</span>
<span className='ps2-btn-price'>
<span className='ps2-sr'>, {priceLabel} </span>
{product.price}
</span>
</>
)
return (
<section
className={`cf-product-selector-2 ${className}`.trim()}
data-force={force}
data-disabled={isDisabled ? 'true' : 'false'}
aria-labelledby={`ps2-title-${uid}`}
>
<style>{CSS}</style>
<div className='ps2-wrap'>
<div className='ps2-ask'>
<div className='ps2-field' aria-hidden='true'>
<div className='ps2-band' />
</div>
<div className='ps2-head ps2-rise'>
<h2 id={`ps2-title-${uid}`} className='ps2-title' data-emph={emph ? '' : undefined}>
<Headline text={headline} emphasis={emph ? headlineEmphasis : undefined} />
</h2>
{lead ? <p className='ps2-lead'>{lead}</p> : null}
</div>
<div
className='ps2-tabs ps2-rise'
style={{ '--i': 2 } as React.CSSProperties}
role='tablist'
aria-orientation='vertical'
aria-label={tabsLabel}
>
{list.map((p, i) => {
const on = i === index
const Icon = p.icon
return (
<button
key={p.id}
ref={(el) => {
tabRefs.current[i] = el
}}
id={tabId(i)}
type='button'
role='tab'
aria-selected={on}
aria-controls={panelId}
tabIndex={on ? 0 : -1}
className='ps2-tab'
data-icon={Icon ? 'true' : 'false'}
data-demo-hover={i === demoHover ? 'true' : undefined}
onClick={() => choose(i)}
onKeyDown={(event) => onKeyDown(event, i)}
>
{Icon ? (
<span className='ps2-disc' aria-hidden='true'>
<Icon size={20} strokeWidth={2.5} />
</span>
) : null}
<span className='ps2-tab-label'>{p.label}</span>
<span className='ps2-tick' aria-hidden='true'>
<Check size={20} strokeWidth={2.5} />
</span>
</button>
)
})}
</div>
</div>
<div
className='ps2-answer ps2-rise'
style={{ '--i': 1 } as React.CSSProperties}
role='tabpanel'
id={panelId}
aria-labelledby={tabId(index)}
>
<div className='ps2-match'>
<div className='ps2-stage'>
<motion.img
key={`${active.id}-shot`}
className='ps2-shot'
src={product.image}
alt={product.imageAlt ?? product.name}
width={520}
height={520}
decoding='async'
draggable={false}
initial={animate ? { opacity: 0, x: -36, rotate: -6, scale: 0.94 } : false}
animate={{ opacity: 1, x: 0, rotate: 0, scale: 1 }}
transition={{ duration: 0.45, ease }}
/>
</div>
<motion.div
key={`${active.id}-copy`}
className='ps2-copy'
initial={animate ? { opacity: 0.35, y: 8 } : false}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, ease, delay: 0.06 }}
>
{active.agitate ? <p className='ps2-agitate'>{active.agitate}</p> : null}
<h3 className='ps2-sub'>{product.headline}</h3>
<p className='ps2-why'>{product.why}</p>
<p className='ps2-price'>
<span className='ps2-sr'>{priceLabel} </span>
<span className='ps2-amount'>{product.price}</span>
{product.priceBreakdown ? <span className='ps2-per'>{product.priceBreakdown}</span> : null}
</p>
</motion.div>
</div>
<div className='ps2-act'>
{href && !isDisabled ? (
<a className='ps2-btn' href={href} onClick={act} aria-describedby={describedBy}>
{inner}
</a>
) : (
<button type='button' className='ps2-btn' disabled={isDisabled} onClick={act} aria-describedby={describedBy}>
{inner}
</button>
)}
{showAssure ? (
<p className='ps2-assure' id={assureId}>
{reassurance.map((text) => (
<span key={text} className='ps2-assure-item'>
<AssureIcon text={text} />
{text}
</span>
))}
</p>
) : null}
{isDisabled ? (
<p className='ps2-note' id={noteId}>
<Info className='ps2-inline' size={16} strokeWidth={2.5} aria-hidden />
{disabledNote}
</p>
) : null}
</div>
</div>
</div>
</section>
)
}
export default ProductSelector2
function Headline({ text, emphasis }: { text: string; emphasis?: string }) {
if (!emphasis) return <>{text}</>
const at = text.indexOf(emphasis)
return (
<>
{text.slice(0, at)}
<em>{emphasis}</em>
{text.slice(at + emphasis.length)}
</>
)
}
function AssureIcon({ text }: { text: string }) {
if (/guarantee|money|refund/i.test(text)) return <ShieldCheck className='ps2-inline' size={16} strokeWidth={2.5} aria-hidden />
if (/secure|checkout|safe/i.test(text)) return <Lock className='ps2-inline' size={16} strokeWidth={2.5} aria-hidden />
return <Check className='ps2-inline' size={16} strokeWidth={2.5} aria-hidden />
}
const R = '.cf-product-selector-2'
const SH = 'var(--shadow, oklch(0.22 0.03 260))'
const BG = 'var(--button-bg, var(--cta))'
const BG2 = 'var(--button-bg-2, var(--cta-2))'
const CSS = `
${R}{--ps2-pt:clamp(56px,8vw,112px);--ps2-pb:clamp(64px,8.5vw,120px);--ps2-gut:clamp(16px,5vw,48px);--ps2-gap:clamp(32px,5vw,72px);--ps2-red:var(--subhead-ink,color-mix(in oklab,var(--cta) 55%,var(--ink)));position:relative;isolation:isolate;overflow:hidden;padding:var(--ps2-pt) var(--ps2-gut) var(--ps2-pb);background:var(--surface);color:var(--ink);font-family:var(--font-body)}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} .ps2-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
${R} .ps2-wrap{position:relative;max-width:1120px;margin-inline:auto;display:grid;grid-template-columns:minmax(0,5fr) minmax(0,6fr);gap:var(--ps2-gap);align-items:start}
/* the angled problem field: a flat band colour cut on the diagonal, the answer card straddles its edge */
${R} .ps2-ask{position:relative;z-index:1;align-self:stretch;background:var(--band);color:var(--band-ink)}
${R} .ps2-field{position:absolute;z-index:-1;top:calc(-1 * var(--ps2-pt));bottom:calc(-1 * var(--ps2-pb));left:-100vw;right:calc(-1 * (var(--ps2-gap) + 96px));background:var(--band);clip-path:polygon(0 0,100% 0,calc(100% - var(--ps2-gap) - 84px) 100%,0 100%)}
${R} .ps2-band{position:absolute;inset:0;background:var(--band)}
${R} .ps2-title{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--band-ink)}
${R} .ps2-title[data-emph]{color:color-mix(in oklch,var(--band-ink) 74%,var(--band))}
${R} .ps2-title em{font-style:normal;color:var(--band-ink)}
${R} .ps2-lead{margin:16px 0 0;max-width:46ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:color-mix(in oklch,var(--band-ink) 86%,var(--band));text-wrap:pretty}
/* problem tabs */
${R} .ps2-tabs{display:grid;gap:12px;margin-top:32px}
${R} .ps2-tab{--ps2-nudge:0px;--ps2-press:1;appearance:none;display:flex;align-items:center;gap:16px;width:100%;min-height:72px;margin:0;padding:12px 18px 12px 14px;border:1px solid oklch(from var(--band-ink) l c h / 0.18);border-radius:var(--radius,12px);background:oklch(from var(--band-ink) l c h / 0.07);color:var(--band-ink);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;text-align:left;cursor:pointer;transform:translateX(var(--ps2-nudge)) scale(var(--ps2-press));transition:transform .16s ease,background-color .16s ease,border-color .16s ease,box-shadow .16s ease,color .16s ease}
${R} .ps2-tab[data-icon=false]{padding-left:20px}
${R} .ps2-tab-label{min-width:0;text-wrap:balance}
${R} .ps2-disc{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:oklch(from var(--band-ink) l c h / 0.12);color:var(--band-ink);transition:background-color .16s ease,color .16s ease}
${R} .ps2-tick{flex:none;display:grid;place-items:center;margin-left:auto;color:var(--accent);opacity:0;transition:opacity .16s ease}
@media (hover:hover){${R} .ps2-tab:not([aria-selected=true]):hover{--ps2-nudge:4px;background:oklch(from var(--band-ink) l c h / 0.13);border-color:oklch(from var(--band-ink) l c h / 0.34)}}
${R}[data-force=hover] .ps2-tab[data-demo-hover]{--ps2-nudge:4px;background:oklch(from var(--band-ink) l c h / 0.13);border-color:oklch(from var(--band-ink) l c h / 0.34)}
${R} .ps2-tab:not([aria-selected=true]):active{--ps2-press:.985}
${R} .ps2-tab[aria-selected=true]{--ps2-nudge:8px;background:var(--card);color:var(--ink);border-color:transparent;cursor:default;box-shadow:var(--shadow-md,0 1px 2px oklch(from ${SH} l c h / 0.22),0 4px 10px -2px oklch(from ${SH} l c h / 0.2))}
${R} .ps2-tab[aria-selected=true] .ps2-disc{background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card))}
${R} .ps2-tab[aria-selected=true] .ps2-tick{opacity:1}
${R} .ps2-tab:focus-visible{outline:3px solid var(--band-ink);outline-offset:3px}
/* answer card: the one raised surface */
${R} .ps2-answer{position:relative;z-index:2;container:ps2card / inline-size;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from ${SH} l c h / 0.22),0 12px 24px -8px oklch(from ${SH} l c h / 0.32)));padding:clamp(20px,3vw,32px)}
${R} .ps2-match{display:grid;grid-template-columns:minmax(0,38%) minmax(0,1fr);gap:24px;align-items:stretch}
${R} .ps2-stage{position:relative;min-height:240px}
${R} .ps2-shot{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;object-position:center;filter:drop-shadow(0 2px 3px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3)) drop-shadow(0 14px 16px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.22))}
${R} .ps2-copy{min-width:0}
${R} .ps2-agitate{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:600;color:var(--ink);text-wrap:pretty}
${R} .ps2-sub{margin:12px 0 0;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;color:var(--ps2-red);text-wrap:balance}
${R} .ps2-agitate + .ps2-sub{margin-top:12px}
${R} .ps2-copy > .ps2-sub:first-child{margin-top:0}
${R} .ps2-why{margin:12px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted);text-wrap:pretty}
${R} .ps2-price{margin:24px 0 0}
${R} .ps2-amount{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
${R} .ps2-per{display:block;margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
@container ps2card (max-width: 430px){${R} .ps2-match{grid-template-columns:minmax(0,1fr);gap:16px}${R} .ps2-stage{min-height:200px}}
/* add to cart */
${R} .ps2-act{margin-top:24px}
${R} .ps2-btn{--ps2-down:0px;display:flex;align-items:center;justify-content:center;gap:12px;width:100%;min-height:64px;margin:0;padding:10px 24px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from ${BG} calc(l + 0.04) c h),oklch(from ${BG2} calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink));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-decoration:none;text-shadow:var(--button-text-shadow,none);cursor:pointer;transform:translateY(var(--ps2-down));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from ${BG} calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from ${BG} calc(l - 0.16) c h),0 1px 2px oklch(from ${SH} l c h / 0.3),0 8px 16px -6px oklch(from ${SH} l c h / 0.4));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .ps2-cart{flex:none}
${R} .ps2-btn-label{min-width:0;text-align:start;text-wrap:balance}
${R} .ps2-btn-price{flex:none;padding:0 0 0 12px;border-left:1px solid color-mix(in oklch,currentColor 35%,transparent);font-variant-numeric:tabular-nums}
@media (hover:hover){${R} .ps2-btn:not(:disabled):hover{background:linear-gradient(oklch(from ${BG} calc(l - 0.01) c h),oklch(from ${BG2} calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from ${BG} calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from ${BG} calc(l - 0.2) c h),0 1px 2px oklch(from ${SH} l c h / 0.32),0 12px 20px -6px oklch(from ${SH} l c h / 0.46))}}
${R}[data-force=hover] .ps2-btn:not(:disabled){background:linear-gradient(oklch(from ${BG} calc(l - 0.01) c h),oklch(from ${BG2} calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from ${BG} calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from ${BG} calc(l - 0.2) c h),0 1px 2px oklch(from ${SH} l c h / 0.32),0 12px 20px -6px oklch(from ${SH} l c h / 0.46))}
${R} .ps2-btn:not(:disabled):active,${R}[data-force=active] .ps2-btn:not(:disabled){--ps2-down:1px;background:linear-gradient(oklch(from ${BG} calc(l - 0.05) c h),oklch(from ${BG2} calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from ${BG} calc(l - 0.24) c h / 0.55),inset 0 -2px 0 oklch(from ${BG} calc(l - 0.16) c h),0 1px 2px oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0.3)}
${R} .ps2-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
${R} .ps2-btn:disabled{background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:none;text-shadow:none;cursor:not-allowed}
${R} .ps2-assure{margin:16px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
${R} .ps2-assure-item{display:inline-block;margin:2px 10px}
${R} .ps2-inline{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;color:var(--accent)}
${R} .ps2-note{margin:16px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
${R} .ps2-note .ps2-inline{color:var(--muted)}
/* phone: the field becomes a band with an angled foot, problems a stacked chip list above the card */
@media (max-width:899px){
${R} .ps2-wrap{grid-template-columns:minmax(0,1fr);gap:32px}
${R} .ps2-ask{align-self:start}
${R} .ps2-field{left:calc(-1 * var(--ps2-gut));right:calc(-1 * var(--ps2-gut));bottom:-72px;clip-path:polygon(0 0,100% 0,100% calc(100% - 56px),0 100%)}
${R} .ps2-tabs{margin-top:24px;gap:8px}
${R} .ps2-tab{min-height:56px;gap:12px;padding:8px 16px 8px 8px;border-radius:999px;font-family:var(--font-body);font-weight:700;font-size:1.0625rem;letter-spacing:0;transform:scale(var(--ps2-press))}
${R} .ps2-tab[data-icon=false]{padding-left:20px}
${R} .ps2-btn{padding:10px 16px;gap:10px}
}
@keyframes ps2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){${R} .ps2-rise{animation:ps2-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * .07s)}}
@media (prefers-reduced-motion:reduce){
${R} .ps2-tab,${R} .ps2-btn,${R} .ps2-disc,${R} .ps2-tick{transition:none}
${R} .ps2-tab{transform:none}
${R} .ps2-btn{transform:none}
}
`
pieces/offer/product-selector-2/specimen.tsx 74 lines
import __studioImage7d5c7e98 from "../assets/11e564b406f58a01.webp";
import __studioImage6cd3fc52 from "../assets/a4997f1948224fce.webp";
import __studioImagefb2821b6 from "../assets/fc7ebcb805f6ca99.webp";
import * as React from 'react'
import { BatteryLow, Dumbbell, Moon } from 'lucide-react'
import { ProductSelector2, type ProductSelector2Problem, type ProductSelector2State } from '../product-selector-2'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled']
export default function ProductSelector2Specimen({ state = 'default' }: { state?: ProductSelector2State }) {
const problems: ProductSelector2Problem[] = [
{
id: 'night',
label: 'Can’t switch off at night',
icon: Moon,
agitate: 'It’s 11pm, the lights are off, and your head is still at work.',
product: {
id: 'moonlit-chamomile',
name: 'Moonlit Chamomile',
headline: 'Meet Moonlit Chamomile, your slow last cup of the day',
why: 'Caffeine-free chamomile, lemon balm and lavender. Steep for five minutes, then put the phone down.',
price: '$24',
priceBreakdown: 'One 30-cup tin, about 80¢ a cup',
image: slot('item-1', __studioImage7d5c7e98),
imageAlt: 'Moonlit Chamomile tea tin with dried chamomile flowers',
},
},
{
id: 'slump',
label: 'Afternoon slump',
icon: BatteryLow,
agitate: '3pm hits, and the to-do list suddenly looks twice as long.',
product: {
id: 'midday-matcha',
name: 'Midday Matcha',
headline: 'Meet Midday Matcha, a two-minute ritual at your desk',
why: 'Stone-ground matcha with a twist of yuzu. Whisk it into water, no machine needed.',
price: '$32',
priceBreakdown: 'One 30-serving tin, about $1.07 a cup',
image: slot('item-2', __studioImage6cd3fc52),
imageAlt: 'Midday Matcha tea tin with a bowl of matcha and a bamboo whisk',
},
},
{
id: 'training',
label: 'Sore after training',
icon: Dumbbell,
agitate: 'Leg day was yesterday. The stairs are today’s problem.',
product: {
id: 'ginger-recovery',
name: 'Ginger Recovery',
headline: 'Meet Ginger Recovery, the warm cup after a hard session',
why: 'Fresh-cut ginger, turmeric and black pepper, brewed strong for after the gym.',
price: '$26',
priceBreakdown: 'One 30-cup tin, about 87¢ a cup',
image: slot('item-3', __studioImagefb2821b6),
imageAlt: 'Ginger Recovery tea tin with sliced ginger and turmeric',
},
},
]
return (
<ProductSelector2
problems={problems}
headline='Which one sounds like your day?'
headlineEmphasis='your day?'
lead='Tap the one that fits. We’ll show you the Steep Society blend made for that exact moment.'
reassurance={[defaults.sample.guarantee, 'Secure checkout']}
state={state}
/>
)
}
| Name | Type | Details |
|---|---|---|
problems RequiredProductSelector2 |
ProductSelector2Problem[] |
|
defaultProblemId OptionalProductSelector2 |
string |
|
headline OptionalProductSelector2 |
string |
Default 'Which one sounds like you?'
|
headlineEmphasis OptionalProductSelector2 |
string |
|
lead OptionalProductSelector2 |
string |
Default ''
|
tabsLabel OptionalProductSelector2 |
string |
Default 'Choose the problem you have'
|
buttonLabel OptionalProductSelector2 |
string |
Default 'Add {name} To Cart'
|
priceLabel OptionalProductSelector2 |
string |
Default 'Price'
|
reassurance OptionalProductSelector2 |
string[] |
Default []
|
disabledNote OptionalProductSelector2 |
string |
Default 'Adding to your cart is unavailable right now.'
|
disabled OptionalProductSelector2 |
boolean |
Default false
|
href OptionalProductSelector2 |
string |
|
state OptionalProductSelector2 |
ProductSelector2State |
Default 'default'
|
onSelect OptionalProductSelector2 |
(problem: ProductSelector2Problem) => void |
|
onAction OptionalProductSelector2 |
(product: ProductSelector2Product, problem: ProductSelector2Problem) => void |
|
className OptionalProductSelector2 |
string |
Default ''
|
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-ink- 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.
-
11e564b406f58a01.webp
image/webp · 27.1 KB
-
a4997f1948224fce.webp
image/webp · 35.1 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB
-
fc7ebcb805f6ca99.webp
image/webp · 66.6 KB