One Step Order 5
One-step order for products sold one-time or by subscription: the product stays lit on its stage while the buyer picks a plan, sees the terms in plain words beside the button, and pays in one card.
Use it in a prompt
Use checkout/one-step-order-5 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/checkout/one-step-order-5.tsx. - Import it and pass your copy and images (Props tab):
import { OneStepOrder5 } from "@/components/funneldna/checkout/one-step-order-5"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/one-step-order-5/component.tsx 665 lines
// layout: sticky-offer-side
// One-step order for products sold one-time or by subscription: the product stays lit on its stage while the buyer picks a plan, sees the terms in plain words beside the button, and pays in one card.
'use client'
import * as React from 'react'
import { AlertCircle, Check, Loader2, Lock, ShieldCheck } from 'lucide-react'
import { AmericanExpress, Discover, Mastercard, Visa } from 'react-svg-credit-card-payment-icons/icons/flat-rounded'
import { Backdrop, FX_HOST } from '../fx/fx'
import tabletop from '../fx/backdrops/tabletop'
export type OneStepOrder5State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type OneStepOrder5Network = 'visa' | 'mastercard' | 'amex' | 'discover'
export type OneStepOrder5Option = {
id: string
/** Plan name on the tile, e.g. One-time purchase. */
name: string
/** The supplied price for this plan, e.g. $49. */
price: string
/** Small line under the price, e.g. one-time payment or per delivery. */
priceNote?: string
/** Short fact line on the tile, e.g. 30 servings, one tub. */
detail?: string
/** Billing terms exactly as supplied. Shown on the tile and beside the button; omit when none were supplied. */
billing?: string
/** Solid flag above the tile, e.g. Best value. Only when it is true. */
flag?: string
}
export type OneStepOrder5Values = { name: string; email: string; card: string; exp: string; cvc: string }
/** Supporting labels, placeholders and validation copy (defaults in ORDER_COPY below the component). */
export type OneStepOrder5Copy = typeof ORDER_COPY
type Field = keyof OneStepOrder5Values
type Errors = Partial<Record<Field, string>>
type Banner = null | 'invalid' | 'failed'
export type OneStepOrder5Props = {
/** Supporting labels, placeholders and validation copy. Templates replace {digits} and {amount} as text. */
copy?: Partial<OneStepOrder5Copy>
/** Receives validated values and the chosen plan. The block never sends or charges anything. A returned promise shows the loading label; a rejection shows copy.failMessage. */
onSubmit?: (values: Readonly<OneStepOrder5Values>, option: OneStepOrder5Option) => void | Promise<void>
headline?: string
lead?: string
/** Short product facts shown as chips under the lead on desktop. */
highlights?: string[]
/** Product name in the desktop readout beside the stage. */
productName?: string
/** Slot product: the product on a transparent background, shown on the lit stage. */
productImage?: string
/** Alt text for the product image. */
productImageAlt?: string
/** The purchase choices, usually one-time and subscribe. Prices and billing terms exactly as supplied. */
options?: OneStepOrder5Option[]
/** id of the option selected on load; defaults to the first. */
defaultOption?: string
/** Show a savings line (worked out from the supplied prices) on the cheaper plan. */
showSavings?: boolean
choiceTitle?: string
contactTitle?: string
paymentTitle?: string
/** The question above the total; the button answers it. */
question?: string
/** Main button label. */
label?: string
/** Only when a guarantee is supplied. */
guarantee?: string
/** Note under the button, joined after the guarantee. */
secureLabel?: string
/** Only list the networks the real processor accepts. */
networks?: OneStepOrder5Network[]
/** Banner shown when validation fails. */
errorMessage?: string
/** Note above the button while checkout is disabled. */
disabledMessage?: string
/** Preview state; hover/active force the button look, error prefills invalid values. */
state?: OneStepOrder5State
/** Locks the form, same as state 'disabled'. */
disabled?: boolean
/** Root class for page-level placement. */
className?: string
}
export function OneStepOrder5({
copy: copyOverrides,
onSubmit,
headline = 'Your daily greens, one scoop at a time',
lead = 'Pick one tub or get a fresh one every 30 days. The price and the terms sit right here, before you pay.',
highlights = [],
productName = 'Northfield Greens',
productImage,
productImageAlt = '',
options = DEFAULT_OPTIONS,
defaultOption,
showSavings = true,
choiceTitle = 'Choose how you want your greens',
contactTitle = 'Where should we send your receipt?',
paymentTitle = 'Pay securely by card',
question = 'Ready for your first scoop?',
label = 'Yes, send me my greens',
guarantee,
secureLabel = 'Secure checkout',
networks = ['visa', 'mastercard', 'amex', 'discover'],
errorMessage = 'Please fix the highlighted fields to finish your order.',
disabledMessage = 'Checkout is unavailable right now.',
state = 'default',
disabled = false,
className,
}: OneStepOrder5Props) {
const copy = { ...ORDER_COPY, ...Object.fromEntries(Object.entries(copyOverrides ?? {}).filter(([, v]) => v !== undefined)) } as OneStepOrder5Copy
const uid = 'os5' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const formId = uid + '-form'
const plans = options.length ? options : DEFAULT_OPTIONS
const initialPlan = plans.find(p => p.id === defaultOption)?.id ?? plans[0].id
const [plan, setPlan] = React.useState(initialPlan)
const [values, setValues] = React.useState<OneStepOrder5Values>(() => (state === 'error' ? { ...ERROR_PREFILL } : { ...EMPTY }))
const [errors, setErrors] = React.useState<Errors>(() => (state === 'error' ? validate(ERROR_PREFILL, copy) : {}))
const [banner, setBanner] = React.useState<Banner>(state === 'error' ? 'invalid' : null)
const [busy, setBusy] = React.useState(false)
const [actionInView, setActionInView] = React.useState(false)
const [pastPlans, setPastPlans] = React.useState(false)
const plansRef = React.useRef<HTMLDivElement | null>(null)
const request = React.useRef(0)
const refs = React.useRef<Partial<Record<Field, HTMLInputElement | null>>>({})
const actionRef = React.useRef<HTMLDivElement | null>(null)
React.useEffect(() => {
request.current++
const prefill = state === 'error' ? { ...ERROR_PREFILL } : { ...EMPTY }
setValues(prefill)
setErrors(state === 'error' ? validate(prefill, copy) : {})
setBanner(state === 'error' ? 'invalid' : null)
setBusy(false)
setPlan(initialPlan)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state])
React.useEffect(() => () => { request.current++ }, [])
React.useEffect(() => {
const el = actionRef.current
if (!el || typeof IntersectionObserver === 'undefined') return
const io = new IntersectionObserver(([entry]) => setActionInView(entry.isIntersecting), { threshold: 0.25 })
io.observe(el)
return () => io.disconnect()
}, [])
React.useEffect(() => {
const el = plansRef.current
if (!el || typeof IntersectionObserver === 'undefined') return
const io = new IntersectionObserver(([entry]) => setPastPlans(!entry.isIntersecting && entry.boundingClientRect.top < 0), { threshold: 0 })
io.observe(el)
return () => io.disconnect()
}, [])
const isDisabled = disabled || state === 'disabled'
const barHidden = !pastPlans || actionInView
const selected = plans.find(p => p.id === plan) ?? plans[0]
const terms = selected.billing ?? selected.priceNote
const savings = showSavings ? savingsFor(plans) : {}
const brand = detectBrand(digits(values.card))
const BrandIcon = brand ? NETS[brand].Icon : null
const assure = [guarantee, secureLabel].filter(Boolean).join(copy.separator)
function update(field: Field, raw: string) {
const value = field === 'card' ? formatCard(raw) : field === 'exp' ? formatExp(raw) : field === 'cvc' ? digits(raw).slice(0, 4) : raw
setValues(prev => ({ ...prev, [field]: value }))
if (errors[field]) setErrors(prev => ({ ...prev, [field]: undefined }))
}
function check(field: Field) {
if (values[field]) setErrors(prev => ({ ...prev, [field]: validate(values, copy)[field] }))
}
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (isDisabled || busy) return
const next = validate(values, copy)
const first = FIELDS.find(f => next[f])
if (first) {
setErrors(next)
setBanner('invalid')
refs.current[first]?.focus()
return
}
setErrors({})
setBanner(null)
if (!onSubmit) return
const id = ++request.current
try {
const result = onSubmit({ ...values }, selected)
if (!result || typeof (result as Promise<void>).then !== 'function') return
setBusy(true)
await result
if (id === request.current) setBusy(false)
} catch {
if (id === request.current) {
setBusy(false)
setBanner('failed')
}
}
}
const field = (f: Field) => {
const meta = FIELD_META[f]
const id = uid + '-' + f
const err = errors[f]
return (
<div className='os5-field' key={f}>
<label htmlFor={id}>{copy[(f + 'Label') as keyof OneStepOrder5Copy]}</label>
<div className={cx('os5-input', f === 'card' && 'has-brand')}>
<input
id={id}
ref={el => { refs.current[f] = el }}
name={f}
type={meta.type}
inputMode={meta.inputMode}
autoComplete={meta.autoComplete}
maxLength={meta.maxLength}
placeholder={copy[(f + 'Placeholder') as keyof OneStepOrder5Copy]}
value={values[f]}
onChange={e => update(f, e.target.value)}
onBlur={() => check(f)}
aria-invalid={err ? true : undefined}
aria-describedby={err ? id + '-err' : undefined}
/>
{f === 'card' && BrandIcon ? <span className='os5-brand' aria-hidden='true'><BrandIcon /></span> : null}
</div>
{err ? <p className='os5-err' id={id + '-err'}><AlertCircle className='os5-ii' aria-hidden='true' strokeWidth={2.5} />{err}</p> : null}
</div>
)
}
return (
<section className={cx('cf-one-step-order-5', className)} data-force={state === 'hover' || state === 'active' ? state : undefined} aria-labelledby={uid + '-h'}>
<style>{CSS}</style>
<div className='os5-wrap'>
<div className='os5-side'>
<div>
<h2 className='os5-h' id={uid + '-h'}>{headline}</h2>
{lead ? <p className='os5-lead'>{lead}</p> : null}
{highlights.length ? (
<ul className='os5-chips'>
{highlights.map(h => <li className='os5-chip' key={h}><Check aria-hidden='true' strokeWidth={2.5} />{h}</li>)}
</ul>
) : null}
</div>
{productImage ? (
<div className='os5-stage' style={FX_HOST}>
<Backdrop src={tabletop} treatment='scrim-dark' />
<img className='os5-product' src={productImage} alt={productImageAlt} width={640} height={640} />
</div>
) : null}
<div className='os5-readout' aria-hidden='true'>
<p className='os5-ro-name'>{productName}</p>
<p className='os5-ro-plan'>{selected.name}</p>
<SupPrice key={selected.id} className='os5-ro-price os5-tick' value={selected.price} />
{terms ? <p className='os5-ro-terms'>{terms}</p> : null}
</div>
</div>
<div className='os5-card'>
<form id={formId} noValidate onSubmit={handleSubmit} aria-label={copy.formLabel}>
<fieldset className='os5-fs' disabled={isDisabled}>
{banner ? <p className='os5-banner' role='alert'><AlertCircle className='os5-ii' aria-hidden='true' strokeWidth={2.5} />{banner === 'failed' ? copy.failMessage : errorMessage}</p> : null}
<div className='os5-group'>
<h3 className='os5-sub' id={uid + '-plans'}>{choiceTitle}</h3>
<div className='os5-tiles' ref={plansRef} role='radiogroup' aria-labelledby={uid + '-plans'}>
{plans.map(p => (
<label className='os5-tile' key={p.id}>
<input type='radio' name={uid + '-plan'} value={p.id} checked={p.id === selected.id} onChange={() => setPlan(p.id)} />
<span className='os5-face'>
{p.flag ? <span className='os5-flag'>{p.flag}</span> : null}
<span className='os5-top'>
<span className='os5-dot' aria-hidden='true'><Check strokeWidth={3} /></span>
<span className='os5-name'>{p.name}</span>
</span>
{p.detail ? <span className='os5-detail'>{p.detail}</span> : null}
<span className='os5-pricebox'>
<SupPrice className='os5-tile-price' value={p.price} />
{p.priceNote ? <span className='os5-note'>{p.priceNote}</span> : null}
</span>
{p.billing ? <span className='os5-billing'>{p.billing}</span> : null}
{savings[p.id] ? <span className='os5-save'>{tpl(copy.saveTemplate, { amount: savings[p.id] })}</span> : null}
</span>
</label>
))}
</div>
</div>
<div className='os5-group'>
<h3 className='os5-sub'>{contactTitle}</h3>
<div className='os5-fields os5-two'>{field('name')}{field('email')}</div>
</div>
<div className='os5-group'>
<h3 className='os5-sub'>{paymentTitle}</h3>
{networks.length ? (
<ul className='os5-nets' aria-label={copy.networksLabel}>
{networks.map(n => {
const Icon = NETS[n].Icon
return <li key={n}><Icon aria-hidden='true' /><span className='os5-sr'>{NETS[n].name}</span></li>
})}
</ul>
) : null}
<div className='os5-fields'>
{field('card')}
<div className='os5-fields os5-pair'>{field('exp')}{field('cvc')}</div>
</div>
</div>
<div className='os5-close' ref={actionRef}>
<h3 className='os5-sub'>{question}</h3>
<div className='os5-total' aria-live='polite'>
<div>
<p className='os5-total-label'>{copy.totalLabel}</p>
<p className='os5-total-plan'>{selected.name}</p>
</div>
<SupPrice key={selected.id} className='os5-total-price os5-tick' value={selected.price} />
{terms ? <p className='os5-total-terms'>{terms}</p> : null}
</div>
{isDisabled ? <p className='os5-dmsg'><Lock className='os5-ii' aria-hidden='true' strokeWidth={2.5} />{disabledMessage}</p> : null}
<button type='submit' className='os5-btn' aria-busy={busy || undefined}>
{busy ? <><Loader2 className='os5-spin' aria-hidden='true' strokeWidth={2.5} />{copy.loadingLabel}</> : label}
</button>
{assure ? (
<p className='os5-assure'>
{guarantee ? <ShieldCheck className='os5-ii os5-ii-ok' aria-hidden='true' strokeWidth={2.5} /> : <Lock className='os5-ii' aria-hidden='true' strokeWidth={2.5} />}
{assure}
</p>
) : null}
</div>
</fieldset>
</form>
</div>
<div className='os5-bar' data-hidden={barHidden ? 'true' : 'false'} aria-hidden={barHidden ? true : undefined}>
<div className='os5-bar-sum'>
<p className='os5-bar-label'>{copy.totalLabel}</p>
<p className='os5-bar-line'>
<SupPrice key={selected.id} className='os5-bar-price os5-tick' value={selected.price} />
{selected.priceNote ? <span className='os5-bar-note'>{selected.priceNote}</span> : null}
</p>
</div>
<button type='submit' form={formId} className='os5-btn os5-btn-bar' disabled={isDisabled} tabIndex={barHidden ? -1 : undefined}>{copy.barLabel}</button>
</div>
</div>
</section>
)
}
export default OneStepOrder5
const ORDER_COPY = {
formLabel: 'Order form',
nameLabel: 'Full name',
namePlaceholder: 'Jane Smith',
emailLabel: 'Email address',
emailPlaceholder: 'you@example.com',
cardLabel: 'Card number',
cardPlaceholder: '1234 1234 1234 1234',
expLabel: 'Expiry date',
expPlaceholder: 'MM / YY',
cvcLabel: 'Security code',
cvcPlaceholder: '123',
nameError: 'Enter your full name.',
emailError: 'Enter a valid email address.',
cardError: 'Check your card number.',
expError: 'Enter a valid expiry date.',
cvcError: 'Enter the {digits}-digit code on your card.',
networksLabel: 'Cards accepted',
saveTemplate: 'Save {amount} on every order',
totalLabel: 'Total today',
barLabel: 'Order now',
loadingLabel: 'Processing your order…',
failMessage: 'We couldn’t complete your order. Please try again.',
separator: ' · ',
}
const DEFAULT_OPTIONS: OneStepOrder5Option[] = [
{ id: 'once', name: 'One-time purchase', price: '$59', priceNote: 'one-time payment', detail: '30 servings, one tub' },
{ id: 'subscribe', name: 'Subscribe & save', price: '$49', priceNote: 'per delivery', detail: '30 servings per delivery', billing: 'Billed every 30 days' },
]
const FIELDS: Field[] = ['name', 'email', 'card', 'exp', 'cvc']
const EMPTY: OneStepOrder5Values = { name: '', email: '', card: '', exp: '', cvc: '' }
const ERROR_PREFILL: OneStepOrder5Values = { name: 'Jordan Lee', email: 'jordan@example', card: '4242 4242 4242 4241', exp: '13 / 24', cvc: '12' }
const FIELD_META: Record<Field, { type: string; autoComplete: string; inputMode: React.HTMLAttributes<HTMLInputElement>['inputMode']; maxLength?: number }> = {
name: { type: 'text', autoComplete: 'name', inputMode: 'text' },
email: { type: 'email', autoComplete: 'email', inputMode: 'email' },
card: { type: 'text', autoComplete: 'cc-number', inputMode: 'numeric', maxLength: 23 },
exp: { type: 'text', autoComplete: 'cc-exp', inputMode: 'numeric', maxLength: 7 },
cvc: { type: 'text', autoComplete: 'cc-csc', inputMode: 'numeric', maxLength: 4 },
}
// Theme exception (theme-contract §3): Visa, Mastercard, American Express and Discover are official
// payment-network marks and keep their official colours. The exception covers only these SVGs.
const NETS = {
visa: { name: 'Visa', Icon: Visa },
mastercard: { name: 'Mastercard', Icon: Mastercard },
amex: { name: 'American Express', Icon: AmericanExpress },
discover: { name: 'Discover', Icon: Discover },
}
/** A price with a superscript currency sign and cents; the full value stays readable to assistive tech. */
function SupPrice({ value, className }: { value: string; className?: string }) {
const m = /^([^0-9]*)([0-9][0-9,]*)(?:[.]([0-9]{1,2}))?(.*)$/.exec(value.trim())
if (!m) return <span className={cx('os5-sp', className)}>{value}</span>
return (
<span className={cx('os5-sp', className)}>
<span className='os5-sr'>{value}</span>
<span className='os5-sp-vis' aria-hidden='true'>
{m[1] ? <span className='os5-sp-sym'>{m[1].trim()}</span> : null}
<span>{m[2]}</span>
{m[3] ? <span className='os5-sp-cents'>{m[3]}</span> : null}
{m[4] ? <span className='os5-sp-tail'>{m[4].trim()}</span> : null}
</span>
</span>
)
}
function cx(...parts: Array<string | false | null | undefined>) {
return parts.filter(Boolean).join(' ')
}
function tpl(template: string, map: Record<string, string>) {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (_, key: string) => map[key] ?? '')
}
function digits(s: string) {
return s.replace(/[^0-9]/g, '')
}
function parseMoney(s?: string) {
const m = /([0-9][0-9,]*(?:[.][0-9]+)?)/.exec(s ?? '')
return m ? Number(m[1].replace(/,/g, '')) : null
}
function symbolOf(s: string) {
return /^[^0-9 ]+/.exec(s.trim())?.[0] ?? '$'
}
function fmt(n: number, sym: string) {
const r = Math.round(n * 100) / 100
return sym + (Number.isInteger(r) ? String(r) : r.toFixed(2))
}
function savingsFor(plans: OneStepOrder5Option[]) {
const parsed = plans.map(p => ({ id: p.id, n: parseMoney(p.price), sym: symbolOf(p.price) }))
const known = parsed.filter(p => p.n !== null) as { id: string; n: number; sym: string }[]
const out: Record<string, string> = {}
if (known.length < 2) return out
const top = Math.max(...known.map(p => p.n))
for (const p of known) if (p.n < top) out[p.id] = fmt(top - p.n, p.sym)
return out
}
function detectBrand(d: string): OneStepOrder5Network | null {
if (/^4/.test(d)) return 'visa'
if (/^(5[1-5]|2[2-7])/.test(d)) return 'mastercard'
if (/^3[47]/.test(d)) return 'amex'
if (/^6(011|5)/.test(d)) return 'discover'
return null
}
function formatCard(raw: string) {
const d = digits(raw).slice(0, 19)
if (detectBrand(d) === 'amex') return [d.slice(0, 4), d.slice(4, 10), d.slice(10, 15)].filter(Boolean).join(' ')
return (d.match(/.{1,4}/g) ?? []).join(' ')
}
function formatExp(raw: string) {
const d = digits(raw).slice(0, 4)
return d.length > 2 ? d.slice(0, 2) + ' / ' + d.slice(2) : d
}
function luhn(d: string) {
let sum = 0
for (let i = 0; i < d.length; i++) {
let n = Number(d[d.length - 1 - i])
if (i % 2 === 1) {
n *= 2
if (n > 9) n -= 9
}
sum += n
}
return d.length > 0 && sum % 10 === 0
}
function validate(v: OneStepOrder5Values, copy: OneStepOrder5Copy): Errors {
const e: Errors = {}
if (v.name.trim().length < 2) e.name = copy.nameError
if (!/^[^ @]+@[^ @]+[.][^ @]{2,}$/.test(v.email.trim())) e.email = copy.emailError
const d = digits(v.card)
const brand = detectBrand(d)
if (d.length < 13 || (brand === 'amex' && d.length !== 15) || !luhn(d)) e.card = copy.cardError
const m = /^([0-9]{2}) [/] ([0-9]{2})$/.exec(v.exp)
if (!m) e.exp = copy.expError
else {
const month = Number(m[1])
const year = 2000 + Number(m[2])
const now = new Date()
if (month < 1 || month > 12 || year < now.getFullYear() || (year === now.getFullYear() && month < now.getMonth() + 1)) e.exp = copy.expError
}
const need = brand === 'amex' ? 4 : 3
if (digits(v.cvc).length !== need) e.cvc = copy.cvcError.replace('{digits}', String(need))
return e
}
const CSS = `
.cf-one-step-order-5 {
--os5-shc: var(--shadow, oklch(0.22 0.03 260));
--os5-well: color-mix(in oklch, var(--ink) 4%, var(--card));
--os5-line: oklch(from var(--ink) l c h / 0.14);
--os5-soft: color-mix(in oklab, var(--band-ink) 86%, var(--band));
--os5-focus: var(--field-focus, var(--accent));
--os5-btn: var(--button-bg, var(--cta));
--os5-btn2: var(--button-bg-2, var(--cta-2));
--os5-num: clamp(2.5rem, 4.2vw, 3.75rem);
--os5-h3: clamp(1.3125rem, 1.8vw, 1.625rem);
--os5-body: clamp(1.0625rem, 1.25vw, 1.125rem);
--os5-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
--os5-sm: var(--shadow-sm, 0 1px 1px oklch(from var(--os5-shc) l c h / 0.18), 0 1px 3px oklch(from var(--os5-shc) l c h / 0.14));
--os5-md: var(--shadow-md, 0 1px 2px oklch(from var(--os5-shc) l c h / 0.22), 0 4px 10px -2px oklch(from var(--os5-shc) l c h / 0.2));
--os5-lg: var(--shadow-lg, 0 2px 4px oklch(from var(--os5-shc) l c h / 0.22), 0 12px 24px -8px oklch(from var(--os5-shc) l c h / 0.32));
position: relative;
box-sizing: border-box;
padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px);
overflow-x: clip;
background: var(--band);
color: var(--band-ink);
font-family: var(--font-body);
font-size: var(--os5-body);
line-height: 1.5;
& *, & *::before, & *::after { box-sizing: border-box; }
& :where(h2, h3, p, ul) { margin: 0; }
& svg { flex: none; }
.os5-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.os5-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; max-width: 1120px; margin-inline: auto; }
.os5-side { display: grid; gap: 24px; min-width: 0; align-content: start; animation: os5-in .45s var(--os5-ease) both; }
.os5-h { 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; color: var(--band-ink); text-wrap: balance; }
.os5-lead { margin-top: 16px; max-width: 60ch; font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: 500; line-height: 1.4; color: var(--os5-soft); text-wrap: pretty; }
.os5-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding: 0; list-style: none; }
.os5-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: 999px; background: oklch(from var(--band-ink) l c h / 0.12); color: var(--band-ink); font-size: .875rem; font-weight: 800; line-height: 1.2; }
.os5-chip svg { width: 16px; height: 16px; }
.os5-stage { position: relative; isolation: isolate; display: flex; align-items: flex-end; justify-content: center; height: clamp(180px, 48vw, 260px); padding: 16px 24px 4px; overflow: hidden; border-radius: 12px; }
.os5-product { position: relative; z-index: 1; display: block; width: auto; max-width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 2px 3px oklch(from var(--os5-shc) calc(l - 0.08) c h / 0.55)) drop-shadow(0 16px 18px oklch(from var(--os5-shc) calc(l - 0.08) c h / 0.45)); }
.os5-readout { display: none; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: end; }
.os5-ro-name { grid-column: 1; font-family: var(--font-display); font-size: var(--os5-h3); font-weight: var(--display-weight, 800); text-transform: var(--display-case, none); letter-spacing: -0.01em; line-height: 1.15; color: var(--band-ink); text-wrap: balance; }
.os5-ro-plan { grid-column: 1; margin-top: 4px; font-size: var(--os5-body); font-weight: 500; color: var(--os5-soft); }
.os5-ro-price { grid-column: 2; grid-row: 1 / span 2; font-size: var(--os5-num); color: var(--band-ink); }
.os5-ro-terms { grid-column: 1 / -1; margin-top: 12px; font-size: .9375rem; font-weight: 600; line-height: 1.4; color: var(--os5-soft); text-wrap: pretty; }
.os5-card { container: os5card / inline-size; min-width: 0; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12)); border-radius: var(--card-radius, var(--radius, 14px)); background: var(--card); color: var(--ink); box-shadow: var(--card-shadow, var(--os5-lg)); animation: os5-in .45s var(--os5-ease) .07s both; }
.os5-fs { min-width: 0; margin: 0; padding: 0; border: 0; }
.os5-group + .os5-group, .os5-close { margin-top: 32px; }
.os5-sub { margin-bottom: 16px; font-family: var(--font-display); font-weight: var(--display-weight, 800); text-transform: var(--display-case, none); font-size: var(--os5-h3); letter-spacing: -0.01em; line-height: 1.15; color: var(--ink); text-wrap: balance; }
.os5-banner { margin-bottom: 24px; padding: 12px 16px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: .9375rem; font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.os5-ii { display: inline-block; width: 16px; height: 16px; vertical-align: -0.15em; margin-inline-end: .4em; }
.os5-ii-ok { color: var(--success); }
.os5-tiles { display: grid; gap: 24px; padding-top: 18px; }
.os5-tile { position: relative; display: block; min-width: 0; cursor: pointer; }
.os5-tile input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.os5-face { position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 22px 18px 18px; border: 2px solid var(--os5-line); border-radius: var(--card-radius, var(--radius, 14px)); background: var(--os5-well); color: var(--ink); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background-color .16s ease; }
.os5-flag { position: absolute; top: -15px; right: 14px; display: inline-flex; align-items: center; min-height: 28px; padding: 4px 12px; border-radius: 999px; background: var(--accent-fill, var(--accent)); color: var(--accent-fill-ink, var(--card)); font-size: .875rem; font-weight: 800; line-height: 1.2; white-space: nowrap; box-shadow: var(--os5-sm); }
.os5-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.os5-dot { display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid oklch(from var(--ink) l c h / 0.4); border-radius: 999px; background: var(--card); color: transparent; transition: background-color .16s ease, border-color .16s ease; }
.os5-dot svg { width: 14px; height: 14px; }
.os5-name { font-size: var(--os5-body); font-weight: 800; line-height: 1.2; text-wrap: balance; }
.os5-detail { order: 2; margin-top: 8px; font-size: .9375rem; font-weight: 500; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.os5-pricebox { order: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 12px; }
.os5-tile-price { font-size: var(--os5-num); color: var(--ink); }
.os5-note { display: block; margin-top: 0; font-size: .9375rem; font-weight: 600; line-height: 1.3; color: var(--muted); }
.os5-billing { order: 3; margin-top: 12px; font-size: .9375rem; font-weight: 700; line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.os5-save { order: 4; font-size: .9375rem; font-weight: 800; line-height: 1.4; color: var(--success); }
.os5-tile:hover .os5-face { border-color: oklch(from var(--ink) l c h / 0.32); transform: translateY(-1px); }
.os5-tile input:checked + .os5-face { border-color: var(--accent); background: color-mix(in oklch, var(--accent) 8%, var(--card)); box-shadow: var(--os5-md); transform: translateY(-4px); }
.os5-tile:active input:not(:disabled) + .os5-face { transform: translateY(-1px); }
.os5-tile input:checked + .os5-face .os5-dot { border-color: var(--accent-fill, var(--accent)); background: var(--accent-fill, var(--accent)); color: var(--accent-fill-ink, var(--card)); }
.os5-tile input:checked + .os5-face .os5-dot svg { animation: os5-pop .3s ease both; }
.os5-tile input:focus-visible + .os5-face { outline: 3px solid var(--os5-focus); outline-offset: 3px; }
.os5-tile input:disabled + .os5-face { opacity: .6; transform: none; box-shadow: none; cursor: not-allowed; }
.os5-tile:has(input:disabled) { cursor: not-allowed; }
.os5-fields { display: grid; gap: 16px; }
.os5-pair { grid-template-columns: 1fr 1fr; }
.os5-field { min-width: 0; }
.os5-field label { display: block; margin-bottom: 8px; font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--label-ink, var(--ink)); }
.os5-input { position: relative; }
.os5-input input { display: block; width: 100%; height: 56px; padding: 0 16px; border: 1px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent)); border-radius: var(--field-radius, var(--radius, 12px)); background: var(--field); color: var(--field-ink); font: inherit; font-size: 1.0625rem; transition: border-color .16s ease, box-shadow .16s ease; }
.os5-input input::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1; }
.os5-input input:hover { border-color: oklch(from var(--ink) l c h / 0.42); }
.os5-input input:focus { outline: none; border-color: var(--os5-focus); box-shadow: 0 0 0 3px oklch(from var(--os5-focus) l c h / 0.35); }
.os5-input input[aria-invalid='true'] { border-color: var(--danger); }
.os5-input input[aria-invalid='true']:focus { box-shadow: 0 0 0 3px oklch(from var(--danger) l c h / 0.3); }
.os5-input input:disabled { cursor: not-allowed; opacity: .7; }
.os5-input.has-brand input { padding-right: 64px; }
.os5-brand { position: absolute; top: 50%; right: 12px; display: flex; width: 40px; transform: translateY(-50%); }
.os5-brand svg { display: block; width: 40px; height: auto; }
.os5-err { margin-top: 8px; font-size: .9375rem; font-weight: 600; line-height: 1.4; color: var(--danger); text-wrap: pretty; }
.os5-nets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.os5-nets li { display: flex; }
.os5-nets svg { display: block; width: 40px; height: auto; }
.os5-total { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; padding: 16px 20px; border-radius: 10px; background: var(--os5-well); }
.os5-total-label { font-size: .9375rem; font-weight: 800; line-height: 1.3; color: var(--ink); }
.os5-total-plan { margin-top: 4px; font-size: .9375rem; font-weight: 500; line-height: 1.3; color: var(--muted); }
.os5-total-price { grid-column: 2; grid-row: 1; font-size: var(--os5-num); color: var(--ink); }
.os5-total-terms { grid-column: 1 / -1; margin-top: 12px; font-size: .9375rem; font-weight: 700; line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.os5-dmsg { margin-top: 16px; font-size: .9375rem; font-weight: 600; line-height: 1.4; color: var(--muted); text-align: center; text-wrap: pretty; }
.os5-assure { margin-top: 12px; font-size: .9375rem; font-weight: 600; line-height: 1.4; color: var(--muted); text-align: center; text-wrap: pretty; }
.os5-sp { display: inline-block; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.os5-sp-vis { display: inline-flex; align-items: flex-start; }
.os5-sp-sym, .os5-sp-cents { margin-top: .1em; font-size: .45em; line-height: 1; letter-spacing: 0; }
.os5-sp-sym { margin-right: .06em; }
.os5-sp-cents { margin-left: .04em; }
.os5-sp-tail { align-self: flex-end; margin: 0 0 .12em .2em; font-size: .4em; font-weight: 700; letter-spacing: 0; }
.os5-tick { animation: os5-tick .3s var(--os5-ease) both; }
.os5-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; margin-top: 16px; padding: 0 28px; border: 0; border-radius: var(--button-radius, var(--radius, 12px)); background: linear-gradient(oklch(from var(--os5-btn) calc(l + 0.04) c h), oklch(from var(--os5-btn2) calc(l - 0.02) c h)); color: var(--button-ink, var(--cta-ink)); font-family: var(--button-font, var(--font-display)); font-size: clamp(1.125rem, 1.55vw, 1.375rem); font-weight: var(--button-weight, 800); line-height: 1.15; text-transform: var(--button-case, none); text-align: center; text-wrap: balance; text-shadow: var(--button-text-shadow, none); cursor: pointer; box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--os5-btn) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--os5-btn) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--os5-shc) l c h / 0.3), 0 8px 16px -6px oklch(from var(--os5-shc) l c h / 0.42)); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.os5-btn svg { width: 20px; height: 20px; }
.os5-btn:hover:not(:disabled), &[data-force='hover'] .os5-btn:not(:disabled) { background: linear-gradient(oklch(from var(--os5-btn) calc(l - 0.01) c h), oklch(from var(--os5-btn2) calc(l - 0.07) c h)); transform: translateY(-1px); box-shadow: inset 0 1px 0 oklch(from var(--os5-btn) calc(l + 0.1) c h / 0.6), inset 0 -3px 0 oklch(from var(--os5-btn) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--os5-shc) l c h / 0.32), 0 12px 20px -8px oklch(from var(--os5-shc) l c h / 0.5); }
.os5-btn:active:not(:disabled), &[data-force='active'] .os5-btn:not(:disabled) { background: linear-gradient(oklch(from var(--os5-btn) calc(l - 0.06) c h), oklch(from var(--os5-btn2) calc(l - 0.08) c h)); transform: translateY(1px); box-shadow: inset 0 2px 3px oklch(from var(--os5-btn) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--os5-btn) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--os5-shc) l c h / 0.3); }
.os5-btn:focus-visible { outline: 3px solid var(--os5-focus); outline-offset: 3px; }
.os5-btn:disabled { background: var(--button-2-bg, var(--secondary)); color: var(--button-2-ink, var(--secondary-ink)); text-shadow: none; box-shadow: var(--button-2-shadow, var(--os5-sm)); transform: none; cursor: not-allowed; }
.os5-btn[aria-busy='true'] { cursor: progress; }
.os5-spin { animation: os5-spin .8s linear infinite; }
.os5-bar { display: none; }
@container os5card (min-width: 420px) {
.os5-tiles { grid-template-columns: 1fr 1fr; gap: 16px; }
.os5-face { padding: 26px 18px 20px; }
.os5-pricebox { flex-direction: column; align-items: flex-start; gap: 0; margin-top: 16px; }
.os5-pricebox .os5-note { margin-top: 12px; }
.os5-two { grid-template-columns: 1fr 1fr; }
}
@container os5card (max-width: 419px) {
.os5-btn { padding: 0 16px; }
}
@media (min-width: 900px) {
.os5-wrap { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.os5-stage { height: clamp(300px, 28vw, 380px); }
.os5-readout { display: grid; }
}
@media (min-width: 900px) and (min-height: 900px) {
.os5-side { position: sticky; top: 24px; }
}
@media (max-width: 899px) {
.os5-chips { display: none; }
.os5-side { gap: 20px; }
.os5-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 12px; margin: 8px calc(-1 * clamp(16px, 5vw, 48px)) calc(-1 * clamp(64px, 8.5vw, 120px)); padding: 12px clamp(16px, 5vw, 48px) calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--card); color: var(--ink); box-shadow: 0 -1px 2px oklch(from var(--os5-shc) l c h / 0.18), 0 -8px 16px -8px oklch(from var(--os5-shc) l c h / 0.32); transition: opacity .2s ease, transform .2s ease, visibility 0s; }
.os5-bar[data-hidden='true'] { opacity: 0; transform: translateY(16px); visibility: hidden; pointer-events: none; transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s; }
.os5-bar-sum { flex: 1; min-width: 0; }
.os5-bar-label { font-size: .875rem; font-weight: 800; line-height: 1.2; color: var(--muted); }
.os5-bar-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 4px; }
.os5-bar-price { font-size: var(--os5-h3); color: var(--ink); }
.os5-bar-note { font-size: .9375rem; font-weight: 600; line-height: 1.3; color: var(--muted); }
.os5-btn-bar { flex: none; width: auto; min-height: 56px; margin-top: 0; padding: 0 20px; font-size: 1.125rem; }
}
@media (forced-colors: active) {
.os5-tile input:checked + .os5-face { outline: 3px solid Highlight; }
}
@media (prefers-reduced-motion: reduce) {
/* !important kept: these (0,1,0) resets must beat the (0,2,0) animation/transition rules above. */
& *, & *::before, & *::after { animation: none !important; transition: none !important; }
.os5-tile:hover .os5-face, .os5-tile input:checked + .os5-face, .os5-btn:hover:not(:disabled), .os5-btn:active:not(:disabled), &[data-force] .os5-btn:not(:disabled), .os5-bar[data-hidden='true'] { transform: none; }
}
}
@keyframes os5-in { from { opacity: .82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes os5-tick { from { opacity: .82; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes os5-pop { from { transform: scale(.9); } to { transform: scale(1); } }
@keyframes os5-spin { to { transform: rotate(360deg); } }
`
pieces/checkout/one-step-order-5/specimen.tsx 27 lines
import productArt from '../assets/a209370126fa532e.webp'
import { OneStepOrder5, type OneStepOrder5State } from '../one-step-order-5'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states: OneStepOrder5State[] = ['default', 'hover', 'active', 'disabled', 'error']
export default function OneStepOrder5Specimen({ state = 'default' }: { state?: OneStepOrder5State }) {
return (
<OneStepOrder5
state={state}
headline='Your daily greens, one scoop at a time'
lead='Pick one tub or get a fresh one every 30 days. The price and the terms sit right here, before you pay.'
highlights={['One scoop a day', 'Mixes in cold water', 'Greens, roots and berries']}
productName='Northfield Greens'
productImage={slot('product', productArt)}
productImageAlt='Northfield Greens daily powder tub beside a wooden scoop of green powder'
options={[
{ id: 'once', name: 'One-time purchase', price: '$59', priceNote: 'one-time payment', detail: '30 servings, one tub', billing: 'Charged once. No subscription.' },
{ id: 'subscribe', name: 'Subscribe & save', price: '$49', priceNote: 'per delivery', detail: '30 servings per delivery', billing: 'Billed every 30 days, cancel any time', flag: 'Best value' },
]}
defaultOption='subscribe'
guarantee={defaults.sample.guarantee}
secureLabel='Secure checkout'
/>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalOneStepOrder5 |
Partial<OneStepOrder5Copy> |
|
onSubmit OptionalOneStepOrder5 |
(values: Readonly<OneStepOrder5Values>, option: OneStepOrder5Option) => void | Promise<void> |
|
headline OptionalOneStepOrder5 |
string |
Default 'Your daily greens, one scoop at a time'
|
lead OptionalOneStepOrder5 |
string |
Default 'Pick one tub or get a fresh one every 30 days. The price and the terms sit right here, before you pay.'
|
highlights OptionalOneStepOrder5 |
string[] |
Default []
|
productName OptionalOneStepOrder5 |
string |
Default 'Northfield Greens'
|
productImage OptionalOneStepOrder5 |
string |
|
productImageAlt OptionalOneStepOrder5 |
string |
Default ''
|
options OptionalOneStepOrder5 |
OneStepOrder5Option[] |
Default DEFAULT_OPTIONS
|
defaultOption OptionalOneStepOrder5 |
string |
|
showSavings OptionalOneStepOrder5 |
boolean |
Default true
|
choiceTitle OptionalOneStepOrder5 |
string |
Default 'Choose how you want your greens'
|
contactTitle OptionalOneStepOrder5 |
string |
Default 'Where should we send your receipt?'
|
paymentTitle OptionalOneStepOrder5 |
string |
Default 'Pay securely by card'
|
question OptionalOneStepOrder5 |
string |
Default 'Ready for your first scoop?'
|
label OptionalOneStepOrder5 |
string |
Default 'Yes, send me my greens'
|
guarantee OptionalOneStepOrder5 |
string |
|
secureLabel OptionalOneStepOrder5 |
string |
Default 'Secure checkout'
|
networks OptionalOneStepOrder5 |
OneStepOrder5Network[] |
Default ['visa', 'mastercard', 'amex', 'discover']
|
errorMessage OptionalOneStepOrder5 |
string |
Default 'Please fix the highlighted fields to finish your order.'
|
disabledMessage OptionalOneStepOrder5 |
string |
Default 'Checkout is unavailable right now.'
|
state OptionalOneStepOrder5 |
OneStepOrder5State |
Default 'default'
|
disabled OptionalOneStepOrder5 |
boolean |
Default false
|
className OptionalOneStepOrder5 |
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-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--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
-
a209370126fa532e.webp
image/webp · 59.8 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
e0015f5afe2d03e2.webp
image/webp · 29.5 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB