Collection Grid 3
Scrolling lookbook: tall editorial collection panels snap side to side while a side index path tracks the one in view and ends at one shop button, so browsing turns straight into a click.
Use it in a prompt
Use offer/collection-grid-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/collection-grid-3.tsx. - Import it and pass your copy and images (Props tab):
import { CollectionGrid3 } from "@/components/funneldna/offer/collection-grid-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/collection-grid-3/component.tsx 628 lines
// layout: path-to-action
// Scrolling lookbook: tall editorial collection panels snap side to side while a side index path tracks the one in view and ends at one shop button, so browsing turns straight into a click.
import * as React from 'react';
import { Check, ChevronLeft, ChevronRight, Scissors } from 'lucide-react';
import { Divider, Spot, FX_HOST } from '../fx/fx';
import gift from '../fx/spots/gift';
export type LookbookCollection = {
/** Stable key; falls back to the name. */
id?: string;
name: string;
/** One short line over the photo, under the name. */
tagline?: React.ReactNode;
/** Supplied number of products in the collection; omit when unknown. */
count?: number;
/** Supplied lowest price as display text, e.g. '$42'; omit when unknown. */
priceFrom?: string;
/** Tall lifestyle photo (slot item-n). Without one the panel shows a clay illustration. */
image?: string;
imageAlt?: string;
/** CSS object-position for the photo. */
imagePosition?: string;
/** Destination for this collection; its shop link and the main button become real links. */
href?: string;
/** Not on sale right now: its links and the main button are disabled. */
disabled?: boolean;
/** Shown instead of the shop link while disabled. */
note?: string;
};
export type CollectionGrid3Copy = {
/** {count} is replaced. */
countOne: string;
/** {count} is replaced. */
countMany: string;
/** {price} is replaced. */
priceFrom: string;
/** Main button; {name} is replaced with the collection in view. */
action: string;
/** Main button while the collection in view is unavailable. */
actionUnavailable: string;
shopLink: string;
unavailable: string;
/** Coupon line when coupon.text is not given; {code} is replaced. */
coupon: string;
psLabel: string;
indexLabel: string;
railLabel: string;
/** {index}, {total} and {name} are replaced. */
slideLabel: string;
/** {index} and {total} are replaced. */
counter: string;
previous: string;
next: string;
empty: string;
};
type EdgeTone = React.ComponentProps<typeof Divider>['tone'];
export type CollectionGrid3Props = {
headline?: string;
/** Phrase inside the headline set in the accent colour. */
highlight?: string;
lead?: React.ReactNode;
/** Selling points beside the intro, each carried by a Spot illustration (an imported spot asset). */
points?: { spot?: string; text: React.ReactNode }[];
collections?: LookbookCollection[];
/** Plain instruction that leads straight into the button. */
instruction?: React.ReactNode;
/** Optional real coupon shown under the button. */
coupon?: { code: string; text?: string };
/** P.S. under the action: restate the main benefit or a real guarantee. */
ps?: React.ReactNode;
copy?: Partial<CollectionGrid3Copy>;
/** Token of the next section for the curved bottom edge; null for a flat edge. */
edge?: EdgeTone | null;
/** Called with the collection when its shop link or the main button is used. */
onAction?: (collection: LookbookCollection, index: number) => void;
state?: 'default' | 'hover' | 'active' | 'disabled';
className?: string;
};
const DEFAULT_COPY: CollectionGrid3Copy = {
countOne: '{count} item',
countMany: '{count} items',
priceFrom: 'From {price}',
action: 'Shop {name}',
actionUnavailable: 'Back soon',
shopLink: 'Shop this collection',
unavailable: 'Back soon',
coupon: 'Use {code} at checkout.',
psLabel: 'P.S.',
indexLabel: 'Collections',
railLabel: 'Collection lookbook',
slideLabel: '{index} of {total}: {name}',
counter: '{index} / {total}',
previous: 'Previous collection',
next: 'Next collection',
empty: 'New collections are on the way. Check back soon.',
};
export function CollectionGrid3(props: CollectionGrid3Props) {
const {
headline = 'Find the collection made for you',
highlight,
lead = 'Scroll the lookbook, pick the one you love and shop it in one click.',
points = [],
collections = [],
instruction = 'Found your favourite? Click the button below to shop it.',
coupon,
ps,
copy,
edge = 'surface' as EdgeTone,
onAction,
state = 'default',
className,
} = props;
const c = { ...DEFAULT_COPY, ...copy };
const uid = React.useId();
const headingId = uid + '-heading';
const panelId = (i: number) => uid + '-panel-' + i;
const railRef = React.useRef<HTMLDivElement>(null);
const panelRefs = React.useRef<Array<HTMLElement | null>>([]);
const lockRef = React.useRef<number | null>(null);
const activeRef = React.useRef(0);
const [active, setActive] = React.useState(0);
const total = collections.length;
const current = total > 0 ? Math.min(active, total - 1) : 0;
const offAll = state === 'disabled';
const atEnd = total > 0 && current === total - 1;
React.useEffect(() => {
const rail = railRef.current;
if (!rail || total === 0) return;
const mq = typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;
let frame = 0;
const update = () => {
frame = 0;
const left = rail.scrollLeft;
const width = rail.clientWidth || 1;
const still = Boolean(mq && mq.matches);
let best = 0;
let bestDist = Infinity;
panelRefs.current.forEach((el, i) => {
if (!el || i >= total) return;
const d = el.offsetLeft - left;
if (Math.abs(d) < bestDist) {
bestDist = Math.abs(d);
best = i;
}
el.style.setProperty('--px', still ? '0' : clampNum(d / width, -1, 1).toFixed(3));
});
if (lockRef.current !== null) {
if (best !== lockRef.current) return;
lockRef.current = null;
}
if (best !== activeRef.current) {
activeRef.current = best;
setActive(best);
}
};
const schedule = () => {
if (!frame) frame = window.requestAnimationFrame(update);
};
const release = () => {
lockRef.current = null;
};
update();
rail.addEventListener('scroll', schedule, { passive: true });
rail.addEventListener('pointerdown', release);
rail.addEventListener('wheel', release, { passive: true });
rail.addEventListener('touchstart', release, { passive: true });
window.addEventListener('resize', schedule);
if (mq && typeof mq.addEventListener === 'function') mq.addEventListener('change', schedule);
return () => {
if (frame) window.cancelAnimationFrame(frame);
rail.removeEventListener('scroll', schedule);
rail.removeEventListener('pointerdown', release);
rail.removeEventListener('wheel', release);
rail.removeEventListener('touchstart', release);
window.removeEventListener('resize', schedule);
if (mq && typeof mq.removeEventListener === 'function') mq.removeEventListener('change', schedule);
};
}, [total]);
const go = React.useCallback((target: number) => {
const rail = railRef.current;
const el = panelRefs.current[target];
if (!rail || !el) return;
const still = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
lockRef.current = target;
activeRef.current = target;
setActive(target);
rail.scrollTo({ left: el.offsetLeft, behavior: still ? 'auto' : 'smooth' });
}, []);
const onRailKey = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (event.target !== event.currentTarget || total === 0) return;
const keys: Record<string, number> = { ArrowRight: current + 1, ArrowLeft: current - 1, Home: 0, End: total - 1 };
if (!(event.key in keys)) return;
event.preventDefault();
go(clampNum(keys[event.key], 0, total - 1));
};
const item = collections[current];
const ctaOff = offAll || !item || Boolean(item.disabled);
const ctaLabel = !item ? '' : item.disabled ? c.actionUnavailable : fill(c.action, { name: item.name });
const ctaClass = ['cg3-cta', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ');
const cta =
item && item.href && !ctaOff ? (
<a className={ctaClass} href={item.href} onClick={() => onAction?.(item, current)}>
{ctaLabel}
</a>
) : (
<button
type='button'
className={ctaClass}
disabled={ctaOff}
onClick={() => {
if (item) onAction?.(item, current);
}}
>
{ctaLabel}
</button>
);
const rootClass = ['cf-collection-grid-3', edge ? 'has-edge' : '', className].filter(Boolean).join(' ');
return (
<section className={rootClass} style={FX_HOST} aria-labelledby={headingId}>
{edge ? <Divider shape='curve' tone={edge} height={56} /> : null}
<style>{CSS}</style>
<div className='cg3-wrap'>
<header className={points.length ? 'cg3-head' : 'cg3-head is-solo'}>
<div className='cg3-intro'>
<h2 id={headingId} className='cg3-h'>
{withHighlight(headline, highlight)}
</h2>
{lead ? <p className='cg3-lead'>{lead}</p> : null}
</div>
{points.length ? (
<ul className='cg3-points'>
{points.map((point, i) => (
<li key={i} className='cg3-point'>
<span className='cg3-point-art' aria-hidden='true'>
{point.spot ? <Spot src={point.spot} size={48} /> : <Check size={20} strokeWidth={2.5} />}
</span>
<span>{point.text}</span>
</li>
))}
</ul>
) : null}
</header>
{total === 0 ? (
<p className='cg3-empty'>{c.empty}</p>
) : (
<div className='cg3-stage'>
<div className='cg3-side'>
<nav className='cg3-index' aria-label={c.indexLabel}>
<ol>
{collections.map((col, i) => {
const cls = [
'cg3-stop',
i === current ? 'is-active' : '',
i <= current ? 'fill-up' : '',
i < current || atEnd ? 'fill-down' : '',
]
.filter(Boolean)
.join(' ');
const meta = col.disabled ? (col.note ?? c.unavailable) : metaLine(col, c);
return (
<li key={keyOf(col, i)} className={cls}>
<span className='cg3-node' aria-hidden='true' />
<button
type='button'
className='cg3-stop-btn'
aria-current={i === current ? 'true' : undefined}
aria-controls={panelId(i)}
onClick={() => go(i)}
>
<span className='cg3-stop-name'>{col.name}</span>
{meta ? <span className='cg3-stop-meta'>{meta}</span> : null}
</button>
</li>
);
})}
</ol>
</nav>
<div className={atEnd ? 'cg3-action is-reached' : 'cg3-action'}>
<div className='cg3-action-lead'>
<span className='cg3-node' aria-hidden='true' />
{instruction ? <p className='cg3-instruction'>{instruction}</p> : null}
</div>
{cta}
{coupon ? (
<p className='cg3-coupon'>
<Scissors className='cg3-coupon-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{couponLine(coupon, c.coupon)}
</p>
) : null}
{ps ? (
<p className='cg3-ps'>
<strong>{c.psLabel}</strong> {ps}
</p>
) : null}
</div>
</div>
<div className='cg3-rail-col'>
<div
ref={railRef}
className='cg3-rail'
role='region'
aria-label={c.railLabel}
tabIndex={0}
onKeyDown={onRailKey}
>
{collections.map((col, i) => {
const meta = metaLine(col, c);
const isActive = i === current;
const nameId = panelId(i) + '-name';
return (
<article
key={keyOf(col, i)}
ref={(el) => {
panelRefs.current[i] = el;
}}
id={panelId(i)}
className={['cg3-panel', isActive ? 'is-active' : '', col.image ? '' : 'no-image']
.filter(Boolean)
.join(' ')}
aria-label={fill(c.slideLabel, { index: String(i + 1), total: String(total), name: col.name })}
style={{ '--i': i } as React.CSSProperties}
onClick={(event) => {
if (!isActive && !(event.target as HTMLElement).closest('a,button')) go(i);
}}
>
<div className='cg3-media'>
{col.image ? (
<img
className='cg3-img'
src={col.image}
alt={col.imageAlt ?? ''}
width={900}
height={1200}
loading={i === 0 ? 'eager' : 'lazy'}
decoding='async'
draggable={false}
style={{ objectPosition: col.imagePosition ?? '50% 40%' }}
/>
) : (
<span className='cg3-fallback' aria-hidden='true'>
<Spot src={gift} size={132} shade='band' light='band-ink' />
</span>
)}
</div>
<div className='cg3-scrim' aria-hidden='true' />
<div className='cg3-dim' aria-hidden='true' />
<div className='cg3-body'>
<h3 id={nameId} className='cg3-name'>
{col.name}
</h3>
{col.tagline ? <p className='cg3-tag'>{col.tagline}</p> : null}
<div className='cg3-foot'>
{meta ? <p className='cg3-meta'>{meta}</p> : null}
{col.disabled ? (
<p className='cg3-note'>{col.note ?? c.unavailable}</p>
) : col.href && !offAll ? (
<a
className='cg3-link'
href={col.href}
aria-describedby={nameId}
onClick={() => onAction?.(col, i)}
>
{c.shopLink}
</a>
) : (
<button
type='button'
className='cg3-link'
aria-describedby={nameId}
disabled={offAll}
onClick={() => onAction?.(col, i)}
>
{c.shopLink}
</button>
)}
</div>
</div>
</article>
);
})}
<div className='cg3-rail-end' aria-hidden='true' />
</div>
<div className='cg3-rail-foot'>
<span className='cg3-count' aria-live='polite'>
{fill(c.counter, { index: pad(current + 1), total: pad(total) })}
</span>
<span className='cg3-progress' aria-hidden='true'>
<span style={{ transform: 'scaleX(' + (current + 1) / total + ')' }} />
</span>
<span className='cg3-nav'>
<button
type='button'
className='cg3-nav-btn'
aria-label={c.previous}
disabled={current === 0}
onClick={() => go(current - 1)}
>
<ChevronLeft size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
<button
type='button'
className='cg3-nav-btn'
aria-label={c.next}
disabled={current >= total - 1}
onClick={() => go(current + 1)}
>
<ChevronRight size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
</span>
</div>
</div>
</div>
)}
</div>
</section>
);
}
export default CollectionGrid3;
function metaLine(col: LookbookCollection, c: CollectionGrid3Copy): string {
const parts: string[] = [];
if (typeof col.count === 'number') {
parts.push(fill(col.count === 1 ? c.countOne : c.countMany, { count: String(col.count) }));
}
if (col.priceFrom) parts.push(fill(c.priceFrom, { price: col.priceFrom }));
return parts.join(' · ');
}
function couponLine(coupon: { code: string; text?: string }, template: string): React.ReactNode {
const tpl = coupon.text ?? template;
const parts = tpl.split('{code}');
if (parts.length === 1) {
return (
<>
<strong className='cg3-code'>{coupon.code}</strong> {tpl}
</>
);
}
return parts.map((part, i) => (
<React.Fragment key={i}>
{i > 0 ? <strong className='cg3-code'>{coupon.code}</strong> : null}
{part}
</React.Fragment>
));
}
function withHighlight(text: string, phrase?: string): React.ReactNode {
if (!phrase) return text;
const at = text.indexOf(phrase);
if (at < 0) return text;
return (
<>
{text.slice(0, at)}
<em className='cg3-em'>{phrase}</em>
{text.slice(at + phrase.length)}
</>
);
}
function fill(template: string, values: Record<string, string>): string {
return Object.keys(values).reduce((out, key) => out.split('{' + key + '}').join(values[key]), template);
}
function pad(n: number): string {
return n < 10 ? '0' + n : String(n);
}
function keyOf(col: LookbookCollection, i: number): string {
return col.id ?? col.name + '-' + i;
}
function clampNum(value: number, min: number, max: number): number {
return Math.max(min, Math.min(max, value));
}
const CSS = `
.cf-collection-grid-3 {
--cg3-band: color-mix(in oklch, var(--ink) 4%, var(--surface));
--cg3-track: oklch(from var(--ink) l c h / 0.16);
--cg3-fill: var(--accent-fill, var(--accent));
--cg3-ring: oklch(from var(--field-focus, var(--accent)) l c h / 0.55);
--cg3-shadow: var(--shadow, oklch(0.22 0.03 260));
--cg3-btn: var(--button-bg, var(--cta));
--cg3-btn-2: var(--button-bg-2, var(--cta-2));
--cg3-gap: 16px;
--cg3-pw: 80%;
background: var(--cg3-band);
color: var(--ink);
font-family: var(--font-body);
padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px);
overflow: hidden;
}
.cf-collection-grid-3.has-edge { padding-bottom: calc(clamp(64px, 8.5vw, 120px) + 56px); }
.cf-collection-grid-3 *, .cf-collection-grid-3 *::before, .cf-collection-grid-3 *::after { box-sizing: border-box; }
.cf-collection-grid-3 .cg3-wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
@keyframes cg3-rise { from { opacity: .82; transform: translateY(8px); } }
.cf-collection-grid-3 .cg3-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px clamp(32px, 5vw, 72px); align-items: start; margin-bottom: clamp(32px, 4vw, 48px); animation: cg3-rise .45s cubic-bezier(.2,.7,.2,1) both; }
.cf-collection-grid-3 .cg3-head.is-solo { grid-template-columns: minmax(0, 46rem); }
.cf-collection-grid-3 .cg3-h { margin: 0 0 16px; font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 3.25rem); line-height: 1.06; font-weight: var(--display-weight, 800); letter-spacing: var(--display-tracking, -0.025em); text-transform: var(--display-case, none); color: var(--ink); text-wrap: balance; }
.cf-collection-grid-3 .cg3-intro .cg3-h:last-child { margin-bottom: 0; }
.cf-collection-grid-3 .cg3-em { font-style: normal; color: var(--accent); }
.cf-collection-grid-3 .cg3-lead { margin: 0; max-width: 60ch; font-size: clamp(1.125rem, 1.5vw, 1.375rem); line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-collection-grid-3 .cg3-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cf-collection-grid-3 .cg3-point { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 16px; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.4; font-weight: 600; color: var(--ink); text-wrap: pretty; }
.cf-collection-grid-3 .cg3-point-art { display: grid; place-items: center; width: 48px; height: 48px; color: var(--accent); }
.cf-collection-grid-3 .cg3-stage { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px clamp(32px, 5vw, 72px); align-items: start; }
.cf-collection-grid-3 .cg3-side { min-width: 0; animation: cg3-rise .45s cubic-bezier(.2,.7,.2,1) .07s both; }
.cf-collection-grid-3 .cg3-rail-col { min-width: 0; }
.cf-collection-grid-3 .cg3-index ol { list-style: none; margin: 0; padding: 0; }
.cf-collection-grid-3 .cg3-stop { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; padding-bottom: 4px; }
.cf-collection-grid-3 .cg3-stop::before, .cf-collection-grid-3 .cg3-stop::after, .cf-collection-grid-3 .cg3-action-lead::before { content: ''; position: absolute; left: 13px; width: 2px; background: var(--cg3-track); transition: background-color .3s ease; }
.cf-collection-grid-3 .cg3-stop::before { top: 0; height: 21px; }
.cf-collection-grid-3 .cg3-stop::after { top: 21px; bottom: 0; }
.cf-collection-grid-3 .cg3-stop:first-child::before { display: none; }
.cf-collection-grid-3 .cg3-stop.fill-up::before, .cf-collection-grid-3 .cg3-stop.fill-down::after, .cf-collection-grid-3 .cg3-action.is-reached .cg3-action-lead::before { background: var(--cg3-fill); }
.cf-collection-grid-3 .cg3-node { position: absolute; z-index: 1; left: 8px; top: 15px; width: 12px; height: 12px; border-radius: 999px; background: var(--cg3-band); border: 2px solid var(--cg3-track); transition: transform .3s cubic-bezier(.2,.7,.2,1), background-color .3s ease, border-color .3s ease; }
.cf-collection-grid-3 .cg3-stop.fill-up > .cg3-node, .cf-collection-grid-3 .cg3-action.is-reached .cg3-node { background: var(--cg3-fill); border-color: var(--cg3-fill); }
.cf-collection-grid-3 .cg3-stop.is-active > .cg3-node { transform: scale(1.5); outline: 2px solid var(--cg3-band); }
.cf-collection-grid-3 .cg3-stop-btn { grid-column: 2; appearance: none; display: block; width: 100%; margin: 0; padding: 10px 14px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background-color .16s ease; }
.cf-collection-grid-3 .cg3-stop-btn:hover { background: var(--card); }
.cf-collection-grid-3 .cg3-stop.is-active .cg3-stop-btn { background: color-mix(in oklch, var(--accent) 10%, var(--card)); }
.cf-collection-grid-3 .cg3-stop-btn:focus-visible { outline: 3px solid var(--cg3-ring); outline-offset: 2px; }
.cf-collection-grid-3 .cg3-stop-name { display: block; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.25; font-weight: 800; color: var(--muted); text-wrap: balance; transition: color .16s ease; }
.cf-collection-grid-3 .cg3-stop-btn:hover .cg3-stop-name, .cf-collection-grid-3 .cg3-stop.is-active .cg3-stop-name { color: var(--ink); }
.cf-collection-grid-3 .cg3-stop-meta { display: block; margin-top: 4px; font-size: .9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-collection-grid-3 .cg3-action-lead { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; min-height: 40px; padding: 12px 0 16px; }
.cf-collection-grid-3 .cg3-action-lead::before { top: 0; bottom: 0; }
.cf-collection-grid-3 .cg3-action-lead .cg3-node { top: 20px; }
.cf-collection-grid-3 .cg3-instruction { grid-column: 2; margin: 0; padding-left: 14px; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; font-weight: 600; color: var(--ink); text-wrap: pretty; }
.cf-collection-grid-3 .cg3-cta { appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 64px; margin: 0; padding: 12px 28px; border: 0; border-radius: var(--button-radius, var(--radius, 12px)); background: linear-gradient(oklch(from var(--cg3-btn) calc(l + 0.04) c h), oklch(from var(--cg3-btn-2) 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); line-height: 1.15; font-weight: var(--button-weight, 800); text-transform: var(--button-case, none); text-align: center; text-decoration: none; text-wrap: balance; text-shadow: var(--button-text-shadow, none); cursor: pointer; box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--cg3-btn) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--cg3-btn) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cg3-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--cg3-shadow) l c h / 0.42)); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.cf-collection-grid-3 .cg3-cta:hover:not(:disabled), .cf-collection-grid-3 .cg3-cta.is-hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(oklch(from var(--cg3-btn) calc(l - 0.01) c h), oklch(from var(--cg3-btn-2) calc(l - 0.07) c h)); box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--cg3-btn) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--cg3-btn) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--cg3-shadow) l c h / 0.32), 0 12px 20px -8px oklch(from var(--cg3-shadow) l c h / 0.5)); }
.cf-collection-grid-3 .cg3-cta:active:not(:disabled), .cf-collection-grid-3 .cg3-cta.is-active:not(:disabled) { transform: translateY(1px); background: linear-gradient(oklch(from var(--cg3-btn) calc(l - 0.04) c h), oklch(from var(--cg3-btn-2) calc(l - 0.08) c h)); box-shadow: inset 0 2px 4px oklch(from var(--cg3-btn) calc(l - 0.22) c h / 0.6), inset 0 -2px 0 oklch(from var(--cg3-btn) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cg3-shadow) l c h / 0.3); }
.cf-collection-grid-3 .cg3-cta:focus-visible { outline: 3px solid var(--cg3-ring); outline-offset: 3px; }
.cf-collection-grid-3 .cg3-cta:disabled { background: var(--button-2-bg, var(--secondary)); color: var(--button-2-ink, var(--secondary-ink)); box-shadow: var(--button-2-shadow, var(--shadow-sm)); text-shadow: none; cursor: not-allowed; transform: none; }
.cf-collection-grid-3 .cg3-coupon { margin: 16px 0 0; padding: 12px 14px; border: 1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12)); border-radius: 10px; background: var(--card); color: var(--ink); font-size: .9375rem; line-height: 1.4; font-weight: 500; text-wrap: pretty; }
.cf-collection-grid-3 .cg3-coupon-ico { display: inline-block; vertical-align: -0.15em; margin-inline-end: .4em; color: var(--accent); }
.cf-collection-grid-3 .cg3-code { font-weight: 800; letter-spacing: .06em; }
.cf-collection-grid-3 .cg3-ps { margin: 16px 0 0; font-size: .9375rem; line-height: 1.5; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-collection-grid-3 .cg3-ps strong { font-weight: 800; color: var(--ink); }
.cf-collection-grid-3 .cg3-rail { position: relative; display: flex; gap: var(--cg3-gap); padding: 2px 0 14px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; }
.cf-collection-grid-3 .cg3-rail::-webkit-scrollbar { display: none; }
.cf-collection-grid-3 .cg3-rail:focus-visible { outline: 3px solid var(--cg3-ring); outline-offset: 3px; }
.cf-collection-grid-3 .cg3-rail-end { flex: 0 0 max(0px, calc(100% - var(--cg3-pw) - var(--cg3-gap))); }
.cf-collection-grid-3 .cg3-panel { position: relative; flex: 0 0 var(--cg3-pw); height: clamp(520px, 46vw, 640px); overflow: hidden; border-radius: var(--card-radius, var(--radius, 12px)); background: var(--band); color: var(--band-ink); box-shadow: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--cg3-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--cg3-shadow) l c h / 0.2))); scroll-snap-align: start; scroll-snap-stop: always; isolation: isolate; animation: cg3-rise .45s cubic-bezier(.2,.7,.2,1) both; animation-delay: min(calc(var(--i, 0) * .07s + .07s), .28s); transition: box-shadow .16s ease; }
.cf-collection-grid-3 .cg3-panel:not(.is-active) { cursor: pointer; }
.cf-collection-grid-3 .cg3-panel.no-image { border-radius: var(--card-radius, var(--radius, 12px)); background: oklch(from var(--band) calc(l + 0.03) c h); box-shadow: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--cg3-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--cg3-shadow) l c h / 0.2))); }
.cf-collection-grid-3 .cg3-media { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.cf-collection-grid-3 .cg3-img { display: block; width: 100%; height: 100%; object-fit: cover; transform: translate3d(calc(var(--px, 0) * -5%), 0, 0) scale(1.14); will-change: transform; user-select: none; }
.cf-collection-grid-3 .cg3-fallback { position: absolute; left: 50%; top: 14%; display: block; transform: translateX(-50%); }
.cf-collection-grid-3 .cg3-scrim { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(to top, oklch(from var(--band) l c h / 0.94) 0%, oklch(from var(--band) l c h / 0.82) 40%, oklch(from var(--band) l c h / 0.5) 62%, oklch(from var(--band) l c h / 0) 85%); }
.cf-collection-grid-3 .cg3-dim { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: oklch(from var(--band) l c h / 0.4); opacity: 0; transition: opacity .3s ease; }
.cf-collection-grid-3 .cg3-panel:not(.is-active) .cg3-dim { opacity: 1; }
.cf-collection-grid-3 .cg3-panel:not(.is-active):hover .cg3-dim { opacity: .55; }
.cf-collection-grid-3 .cg3-body { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: clamp(20px, 3vw, 32px); }
.cf-collection-grid-3 .cg3-name { margin: 0 0 .48em; font-family: var(--font-display); font-size: clamp(2.5rem, 4.2vw, 3.75rem); line-height: 1.04; font-weight: var(--display-weight, 800); letter-spacing: -0.03em; text-transform: var(--display-case, none); color: var(--band-ink); text-wrap: balance; }
.cf-collection-grid-3 .cg3-name:last-child { margin-bottom: 0; }
.cf-collection-grid-3 .cg3-tag { margin: 0 0 20px; max-width: 36ch; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; font-weight: 500; color: var(--band-ink); text-wrap: pretty; }
.cf-collection-grid-3 .cg3-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; }
.cf-collection-grid-3 .cg3-meta, .cf-collection-grid-3 .cg3-note { margin: 0; font-size: .9375rem; line-height: 1.4; font-weight: 700; color: var(--band-ink); font-variant-numeric: tabular-nums; }
.cf-collection-grid-3 .cg3-link { appearance: none; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0; border: 0; background: none; color: var(--band-ink); font-family: var(--font-body); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.2; font-weight: 800; text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: oklch(from var(--band-ink) l c h / 0.5); text-underline-offset: .22em; cursor: pointer; transition: text-decoration-color .16s ease, transform .16s ease; }
.cf-collection-grid-3 .cg3-link:hover:not(:disabled) { text-decoration-color: var(--band-ink); }
.cf-collection-grid-3 .cg3-link:active:not(:disabled) { transform: translateY(1px); }
.cf-collection-grid-3 .cg3-link:focus-visible { outline: 3px solid var(--band-ink); outline-offset: 4px; border-radius: 4px; }
.cf-collection-grid-3 .cg3-link:disabled { cursor: not-allowed; text-decoration: none; opacity: .7; }
.cf-collection-grid-3 .cg3-rail-foot { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.cf-collection-grid-3 .cg3-count { min-width: 4.5em; font-size: .9375rem; line-height: 1.4; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cf-collection-grid-3 .cg3-progress { flex: 1 1 auto; height: 4px; border-radius: 999px; background: var(--cg3-track); overflow: hidden; }
.cf-collection-grid-3 .cg3-progress > span { display: block; height: 100%; background: var(--cg3-fill); transform-origin: left center; transition: transform .3s cubic-bezier(.2,.7,.2,1); }
.cf-collection-grid-3 .cg3-nav { display: flex; gap: 8px; }
.cf-collection-grid-3 .cg3-nav-btn { appearance: none; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 1px solid var(--button-2-border, transparent); border-radius: 999px; background: var(--button-2-bg, var(--secondary)); color: var(--button-2-ink, var(--secondary-ink)); box-shadow: var(--button-2-shadow, var(--shadow-sm)); cursor: pointer; transition: background-color .16s ease, transform .16s ease; }
.cf-collection-grid-3 .cg3-nav-btn:hover:not(:disabled) { background: oklch(from var(--button-2-bg, var(--secondary)) calc(l - 0.04) c h); }
.cf-collection-grid-3 .cg3-nav-btn:active:not(:disabled) { transform: translateY(1px); }
.cf-collection-grid-3 .cg3-nav-btn:focus-visible { outline: 3px solid var(--cg3-ring); outline-offset: 2px; }
.cf-collection-grid-3 .cg3-nav-btn:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.cf-collection-grid-3 .cg3-empty { margin: 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); box-shadow: var(--card-shadow, var(--shadow-sm)); color: var(--muted); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; text-align: center; }
@media (max-width: 860px) {
.cf-collection-grid-3 { --cg3-pw: 100%; --cg3-gap: 12px; }
.cf-collection-grid-3 .cg3-head { grid-template-columns: minmax(0, 1fr); }
.cf-collection-grid-3 .cg3-points { gap: 8px; }
.cf-collection-grid-3 .cg3-stage { grid-template-columns: minmax(0, 1fr); }
.cf-collection-grid-3 .cg3-side { display: contents; }
.cf-collection-grid-3 .cg3-index { order: 1; }
.cf-collection-grid-3 .cg3-rail-col { order: 2; }
.cf-collection-grid-3 .cg3-action { order: 3; margin-top: 8px; }
.cf-collection-grid-3 .cg3-index ol { display: flex; flex-wrap: wrap; gap: 8px; }
.cf-collection-grid-3 .cg3-stop { display: block; padding: 0; }
.cf-collection-grid-3 .cg3-stop::before, .cf-collection-grid-3 .cg3-stop::after, .cf-collection-grid-3 .cg3-action-lead::before, .cf-collection-grid-3 .cg3-node { display: none; }
.cf-collection-grid-3 .cg3-stop-btn { display: inline-flex; align-items: center; width: auto; min-height: 44px; padding: 8px 16px; border: 1px solid oklch(from var(--ink) l c h / 0.12); border-radius: 999px; background: var(--card); }
.cf-collection-grid-3 .cg3-stop.is-active .cg3-stop-btn { background: color-mix(in oklch, var(--accent) 12%, var(--card)); border-color: oklch(from var(--accent) l c h / 0.55); }
.cf-collection-grid-3 .cg3-stop-name { font-size: .875rem; color: var(--ink); white-space: nowrap; }
.cf-collection-grid-3 .cg3-stop-meta { display: none; }
.cf-collection-grid-3 .cg3-action-lead { display: block; min-height: 0; padding: 0 0 16px; }
.cf-collection-grid-3 .cg3-instruction { padding-left: 0; }
.cf-collection-grid-3 .cg3-panel { height: clamp(440px, 125vw, 540px); }
.cf-collection-grid-3 .cg3-scrim { background: linear-gradient(to top, oklch(from var(--band) l c h / 0.95) 0%, oklch(from var(--band) l c h / 0.84) 48%, oklch(from var(--band) l c h / 0.5) 70%, oklch(from var(--band) l c h / 0) 92%); }
}
@media (prefers-reduced-motion: reduce) {
.cf-collection-grid-3 *, .cf-collection-grid-3 *::before, .cf-collection-grid-3 *::after { animation: none !important; transition: none !important; }
.cf-collection-grid-3 .cg3-img { transform: none; will-change: auto; }
}
`;
pieces/offer/collection-grid-3/specimen.tsx 82 lines
import __studioImagebe9f07d8 from "../assets/4d48574a10089bb4.webp";
import __studioImagea289d774 from "../assets/0c5b0ac34604c90c.webp";
import __studioImage84f28119 from "../assets/ab070f9bfdb23215.webp";
// Specimen: Stem & Sill, a fictional flower shop, shows its seasonal collections as a scrolling lookbook.
import * as React from 'react';
import { CollectionGrid3 } from '../collection-grid-3';
import { slot } from '../../slots';
import truck from '../../fx/spots/truck';
import gift from '../../fx/spots/gift';
import shield from '../../fx/spots/shield';
export const states = ['default', 'hover', 'active', 'disabled'];
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled';
export default function CollectionGrid3Specimen({ state = 'default' }: { state?: SpecimenState }): React.ReactElement {
return (
<CollectionGrid3
state={state}
headline='Bring this season home'
highlight='this season'
lead='Every Stem & Sill collection is built around what’s blooming right now. Scroll the lookbook, pick your favourite and we’ll do the arranging.'
points={[
{ spot: truck, text: 'Hand-delivered across town the same day' },
{ spot: gift, text: 'A handwritten card in every box' },
{ spot: shield, text: 'Fresh for 7 days, or we replace them' },
]}
collections={[
{
id: 'spring-garden',
name: 'Spring Garden',
tagline: 'Ranunculus, tulips and sweet pea, cut the morning they ship.',
count: 14,
priceFrom: '$42',
image: slot(
'item-1',
__studioImagebe9f07d8
),
imageAlt: 'Peach ranunculus, white tulips and sweet pea in a glass vase on a sunny windowsill',
imagePosition: '50% 35%',
},
{
id: 'peony-season',
name: 'Peony Season',
tagline: 'Blush and coral peonies for the few weeks they bloom.',
count: 9,
priceFrom: '$58',
image: slot(
'item-2',
__studioImagea289d774
),
imageAlt: 'Blush and coral peonies in a white ceramic pitcher on an oak table',
imagePosition: '50% 30%',
},
{
id: 'late-summer-wild',
name: 'Late Summer Wild',
tagline: 'Dahlias, cosmos and grasses, loose and garden-picked.',
count: 12,
priceFrom: '$46',
image: slot(
'item-3',
__studioImage84f28119
),
imageAlt: 'Dahlias, cosmos and grasses in a stoneware jug by an open door',
imagePosition: '50% 32%',
},
{
id: 'winter-evergreen',
name: 'Winter Evergreen',
tagline: 'Cedar, winter berries and white amaryllis.',
disabled: true,
note: 'Back with the first frost',
},
]}
instruction='Found the one? Click the button below to shop it.'
coupon={{ code: 'FIRSTSTEM', text: 'Use {code} for 10% off your first order.' }}
ps='Every bouquet is cut to order the morning it ships, so it reaches your table at its freshest.'
copy={{ countOne: '{count} bouquet', countMany: '{count} bouquets' }}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalCollectionGrid3 |
string |
|
highlight OptionalCollectionGrid3 |
string |
|
lead OptionalCollectionGrid3 |
React.ReactNode |
|
points OptionalCollectionGrid3 |
{ spot?: string; text: React.ReactNode }[] |
|
collections OptionalCollectionGrid3 |
LookbookCollection[] |
|
instruction OptionalCollectionGrid3 |
React.ReactNode |
|
coupon OptionalCollectionGrid3 |
{ code: string; text?: string } |
|
ps OptionalCollectionGrid3 |
React.ReactNode |
|
copy OptionalCollectionGrid3 |
Partial<CollectionGrid3Copy> |
|
edge OptionalCollectionGrid3 |
EdgeTone | null |
|
onAction OptionalCollectionGrid3 |
(collection: LookbookCollection, index: number) => void |
|
state OptionalCollectionGrid3 |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalCollectionGrid3 |
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.
-
0c5b0ac34604c90c.webp
image/webp · 91.8 KB
-
4d48574a10089bb4.webp
image/webp · 74 KB
-
63571cb07acc4626.webp
image/webp · 17.3 KB
-
75ba15955a7397f6.webp
image/webp · 18.6 KB
-
7d6f1c81c93d8f71.webp
image/webp · 18.2 KB
-
ab070f9bfdb23215.webp
image/webp · 180 KB