Product Card Grid
Responsive product cards with sale badges, ratings and a wishlist button layered above the card link so it stays clickable.
A "you might also like" row on native scroll-snap — touch swiping, momentum and keyboard support for free, with no carousel library.
components/product-rail.tsxnpx hoverlab add product-rail
Or over MCP, from your editor's agent — no account needed.
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Start a page with this section — add more, order them, and leave with the page source.
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
/**
* <ProductRail> — a horizontally scrolling "you might also like" row.
*
* Built on native overflow scrolling with CSS scroll-snap rather than a
* carousel library. That buys touch swiping, momentum, keyboard arrow keys
* and a real scrollbar for free — all of which a JavaScript carousel has to
* reimplement, usually incompletely.
*
* `scroll-snap-align: start` on each card and `scroll-padding-inline` on
* the track together stop a snapped card from sitting flush against the
* viewport edge, which is what makes a rail look like it was cropped rather
* than designed.
*
* Server component.
*/
import * as React from 'react'
export interface RailProduct {
id: string
name: string
/** Price in minor units — 1999 is £19.99. Never a float. */
price: number
/** Tailwind gradient classes standing in for the product image. */
swatch?: string
}
/**
* Minor units → a formatted price.
*
* Deliberately duplicated from `product-grid` rather than imported from it.
* Every block in this catalog is copied on its own, and a cross-block
* import is an invisible dependency: the file compiles here, and breaks the
* moment someone takes this rail without also taking the grid. Three lines
* of duplication is the cheaper mistake.
*/
function formatPrice(minor: number, currency = 'GBP', locale = 'en-GB'): string {
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(minor / 100)
}
export interface ProductRailProps {
products?: RailProduct[]
heading?: string
subheading?: string
currency?: string
locale?: string
viewAllHref?: string
className?: string
}
const DEFAULT_PRODUCTS: RailProduct[] = [
{ id: '1', name: 'Lambswool Scarf', price: 4500, swatch: 'from-rose-200 to-rose-400' },
{ id: '2', name: 'Cable Knit Jumper', price: 9800, swatch: 'from-amber-200 to-amber-500' },
{ id: '3', name: 'Corduroy Trousers', price: 7900, swatch: 'from-emerald-200 to-emerald-500' },
{ id: '4', name: 'Suede Chelsea Boots', price: 16500, swatch: 'from-stone-300 to-stone-600' },
{ id: '5', name: 'Linen Pocket Square', price: 2400, swatch: 'from-sky-200 to-sky-400' },
{ id: '6', name: 'Wool Overcoat', price: 28000, swatch: 'from-indigo-300 to-indigo-700' },
]
export function ProductRail({
products = DEFAULT_PRODUCTS,
heading = 'You might also like',
subheading,
currency = 'GBP',
locale = 'en-GB',
viewAllHref,
className = '',
}: ProductRailProps) {
return (
<section className={`w-full ${className}`}>
<div className="mb-4 flex items-baseline justify-between gap-4">
<div>
<h2 className="text-xl font-bold tracking-tight">{heading}</h2>
{subheading ? (
<p className="mt-0.5 text-sm text-muted-foreground">{subheading}</p>
) : null}
</div>
{viewAllHref ? (
<a
href={viewAllHref}
className="shrink-0 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground"
>
View all
</a>
) : null}
</div>
{/*
Native scroller. `scroll-padding-inline` keeps a snapped card off
the edge; without it the first card looks clipped at every stop.
*/}
<ul className="flex snap-x snap-mandatory gap-4 overflow-x-auto scroll-smooth pb-3 [scroll-padding-inline:0.25rem]">
{products.map((product) => (
<li
key={product.id}
className="w-40 min-w-0 shrink-0 snap-start sm:w-48"
>
<a href={`/products/${product.id}`} className="group block">
<div className="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div
aria-hidden
className={`h-full w-full bg-gradient-to-br ${product.swatch ?? 'from-muted to-muted-foreground/20'} transition-transform duration-500 group-hover:scale-105`}
/>
</div>
<p className="mt-2 truncate text-sm font-medium">{product.name}</p>
<p className="text-sm text-muted-foreground">
{formatPrice(product.price, currency, locale)}
</p>
</a>
</li>
))}
</ul>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/product-rail.tsx and import it where you need the section:
import { ProductRail } from '@/components/product-rail'3 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.
Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.
| Prop | Type | Default |
|---|---|---|
products | RailProduct[] | DEFAULT_PRODUCTS |
heading | string | 'You might also like' |
subheading | string | — |
currency | string | 'GBP' |
locale | string | 'en-GB' |
viewAllHref | string | — |
className | string | '' |
The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.
<!--
Scroll-Snap Product Rail — markup from the Hoverlab catalog.
This is the block rendered once to HTML and wrapped as a component
file. It is not a port of the React source: the Tailwind classes carry
the design, which is the part that took the work, and they are the same
in every framework.
This block has no interactive behaviour, so nothing is missing.
-->
<section class="w-full ">
<div class="mb-4 flex items-baseline justify-between gap-4">
<div>
<h2 class="text-xl font-bold tracking-tight">You might also like</h2>
</div>
</div>
<ul class="flex snap-x snap-mandatory gap-4 overflow-x-auto scroll-smooth pb-3 [scroll-padding-inline:0.25rem]">
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/1" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-rose-200 to-rose-400 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Lambswool Scarf</p>
<p class="text-sm text-muted-foreground">£45.00</p>
</a>
</li>
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/2" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-amber-200 to-amber-500 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Cable Knit Jumper</p>
<p class="text-sm text-muted-foreground">£98.00</p>
</a>
</li>
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/3" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-emerald-200 to-emerald-500 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Corduroy Trousers</p>
<p class="text-sm text-muted-foreground">£79.00</p>
</a>
</li>
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/4" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-stone-300 to-stone-600 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Suede Chelsea Boots</p>
<p class="text-sm text-muted-foreground">£165.00</p>
</a>
</li>
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/5" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-sky-200 to-sky-400 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Linen Pocket Square</p>
<p class="text-sm text-muted-foreground">£24.00</p>
</a>
</li>
<li class="w-40 min-w-0 shrink-0 snap-start sm:w-48">
<a href="/products/6" class="group block">
<div class="aspect-[4/5] overflow-hidden rounded-xl border border-border/60 bg-muted">
<div aria-hidden="true" class="h-full w-full bg-gradient-to-br from-indigo-300 to-indigo-700 transition-transform duration-500 group-hover:scale-105"></div>
</div>
<p class="mt-2 truncate text-sm font-medium">Wool Overcoat</p>
<p class="text-sm text-muted-foreground">£280.00</p>
</a>
</li>
</ul>
</section>
What each framework gets across the whole catalog — effects convert properly; this rung is markup.
The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.
Want the whole screen instead of this one section? Open a page and copy it entire.
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Product ListingsCopying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
Responsive product cards with sale badges, ratings and a wishlist button layered above the card link so it stays clickable.
Category, size, colour and price facets as proper fieldsets, with colour swatches that carry their name as well as their hue.
Result count, sort and density switch — with the count in an aria-live region, since it is the only feedback a filter change gives some users.
Three products side by side with the row labels pinned through a horizontal scroll, an "only show differences" toggle that says how many rows it hid, and "best" marked only where better means something.
Availability per variant stated before the cart, because discovering it at checkout is where the basket gets abandoned.
The editorial header above a collection grid, carrying the four facts that decide a considered purchase.
Results on one side, a drawn map on the other, scrolling independently. The map is explicitly decorative and out of the tab order — the list is the content, not its companion.
A restaurant menu typeset as a bill of fare rather than a product grid — dotted leaders to the price, dietary marks as abbreviations with a key, and prices as strings so “market price” still fits.