Product Card Grid
Responsive product cards with sale badges, ratings and a wishlist button layered above the card link so it stays clickable.
Availability per variant stated before the cart, because discovering it at checkout is where the basket gets abandoned.
components/stock-availability-list.tsxnpx hoverlab add stock-availability-list
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.
"In stock" on a listing that means "one of nine variants is in stock" is the single most expensive lie in commerce UI — it is discovered at checkout, and the basket is abandoned there.
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <StockAvailabilityList> — Availability per variant stated before the cart, because discovering it at checkout is where the basket gets abandoned.
*
* "In stock" on a listing where one of nine variants is in stock is the
* most expensive lie in commerce UI. It is discovered at checkout, and the
* basket is abandoned there. The layout problem is surfacing per-variant
* availability before the cart without turning the listing into a
* spreadsheet.
*
* Four rows, one per variant, each with a real state. The obvious wrong
* answer is a single badge on the product, which is the lie above.
*
* The counts are live numbers rather than a scarcity banner, and the detail
* on the low row says so. "3 left" that is true is useful; "Only 3 left!"
* that is decoration trains people to ignore both, and the second is the one
* that ends up in a regulator's example of a dark pattern.
*
* The made-to-order row is the one most implementations get wrong by
* filing it under "in stock". Six weeks is not out of stock and it is not
* available — it is a third state, and stating it here is the difference
* between a delighted customer and a chargeback.
*
* Rows are buttons with `aria-pressed` because selecting a variant is the
* action. `status` carries the count separately from `tone` so "out" and "3
* left" are readable without colour, which matters on the row that changes a
* purchase decision. The demo selects the first available variant, not the
* sold-out one.
*/
import * as React from 'react'
type Tone = 'neutral' | 'positive' | 'warning' | 'critical'
export interface StockAvailabilityListRow {
id: string
label: string
detail?: string
tone?: Tone
/** What the badge says. Falls back to the tone name when absent. */
status?: string
}
export interface StockAvailabilityListProps {
heading?: string
intro?: string
rows?: StockAvailabilityListRow[]
className?: string
}
/*
Tones as complete utility classes, never assembled from fragments.
Tailwind scans source text, so `text-${tone}-foreground` produces no
class at all — the same failure as an undefined token, and just as
invisible in review.
*/
const TONE_CLASS: Record<Tone, string> = {
neutral: 'bg-muted text-muted-foreground',
positive: 'bg-primary/10 text-primary',
warning: 'bg-accent text-accent-foreground',
critical: 'bg-destructive/10 text-destructive',
}
const ROWS: StockAvailabilityListRow[] = [
{ id: "row-1", label: "Small — Charcoal", detail: "Ships today if ordered before 4pm.", tone: "positive", status: "42 left" },
{ id: "row-2", label: "Medium — Charcoal", detail: "Low. The counter is live, not a scarcity banner.", tone: "warning", status: "3 left" },
{ id: "row-3", label: "Large — Charcoal", detail: "Restocking. Notify me is on the product page.", tone: "critical", status: "out" },
{ id: "row-4", label: "Small — Sand", detail: "Made to order. Six weeks, stated here rather than at checkout.", tone: "neutral", status: "6 weeks" },
]
export function StockAvailabilityList({
heading = "What is actually available",
intro = "\"In stock\" on a listing that means \"one of nine variants is in stock\" is the single most expensive lie in commerce UI — it is discovered at checkout, and the basket is abandoned there.",
rows = ROWS,
className,
}: StockAvailabilityListProps) {
/*
Per-instance prefix for every id this block emits.
The literals these replaced were a latent duplicate the moment the
block appeared twice on one document, and `aria-labelledby` on a
duplicated id resolves to the first match -- so the second copy was
labelled by the first copy's heading. Client component, so `useId` is
the right tool.
*/
const uid = React.useId()
const [selected, setSelected] = React.useState<string | null>(rows[0]?.id ?? null)
return (
<section
aria-labelledby={`${uid}-stock-availability-list-heading`}
className={`w-full bg-background px-6 py-16 ${className ?? ''}`}
>
<div className="mx-auto max-w-3xl">
<h2
id={`${uid}-stock-availability-list-heading`}
className="text-2xl font-semibold tracking-tight text-foreground"
>
{heading}
</h2>
<p className="mt-2 text-sm text-muted-foreground">{intro}</p>
<ul className="mt-8 divide-y divide-border overflow-hidden rounded-xl border border-border bg-card">
{rows.map((row) => {
const isSelected = row.id === selected
return (
<li key={row.id}>
{/*
A button, not a div with onClick. The row is operable, so
it has to be reachable by keyboard and announce its
selected state — aria-pressed is what carries that.
*/}
<button
type="button"
aria-pressed={isSelected}
onClick={() => setSelected(row.id)}
className={`flex w-full items-center justify-between gap-4 px-5 py-4 text-start transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset ${
isSelected ? 'bg-muted/40' : ''
}`}
>
<span className="min-w-0 flex-1">
<span className="block truncate text-sm font-medium text-foreground">
{row.label}
</span>
{row.detail ? (
<span className="mt-0.5 block break-words text-sm text-muted-foreground">
{row.detail}
</span>
) : null}
</span>
<span
className={`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium ${
TONE_CLASS[row.tone ?? 'neutral']
}`}
>
{row.status ?? row.tone ?? 'neutral'}
</span>
</button>
</li>
)
})}
</ul>
</div>
</section>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/stock-availability-list.tsx and import it where you need the section:
import { StockAvailabilityList } from '@/components/stock-availability-list'1 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 |
|---|---|---|
heading | string | "What is actually available" |
intro | string | — |
rows | StockAvailabilityListRow[] | ROWS |
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.
This block is interactive. The markup below is its initial state with the event handlers stripped — you will need to re-wire the behaviour in your framework.
<!--
Stock Availability List — 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 is interactive in React and the handlers are NOT here.
Buttons, toggles and menus render in their initial state and do
nothing until you wire them up.
-->
<section aria-labelledby="_R_0_-stock-availability-list-heading" class="w-full bg-background px-6 py-16 ">
<div class="mx-auto max-w-3xl">
<h2 id="_R_0_-stock-availability-list-heading" class="text-2xl font-semibold tracking-tight text-foreground">What is actually available</h2>
<p class="mt-2 text-sm text-muted-foreground">"In stock" on a listing that means "one of nine variants is in stock" is the single most expensive lie in commerce UI — it is discovered at checkout, and the basket is abandoned there.</p>
<ul class="mt-8 divide-y divide-border overflow-hidden rounded-xl border border-border bg-card">
<li>
<button type="button" aria-pressed="true" class="flex w-full items-center justify-between gap-4 px-5 py-4 text-start transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset bg-muted/40">
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-medium text-foreground">Small — Charcoal</span>
<span class="mt-0.5 block break-words text-sm text-muted-foreground">Ships today if ordered before 4pm.</span>
</span>
<span class="shrink-0 rounded-full px-2.5 py-1 text-xs font-medium bg-primary/10 text-primary">42 left</span>
</button>
</li>
<li>
<button type="button" aria-pressed="false" class="flex w-full items-center justify-between gap-4 px-5 py-4 text-start transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset ">
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-medium text-foreground">Medium — Charcoal</span>
<span class="mt-0.5 block break-words text-sm text-muted-foreground">Low. The counter is live, not a scarcity banner.</span>
</span>
<span class="shrink-0 rounded-full px-2.5 py-1 text-xs font-medium bg-accent text-accent-foreground">3 left</span>
</button>
</li>
<li>
<button type="button" aria-pressed="false" class="flex w-full items-center justify-between gap-4 px-5 py-4 text-start transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset ">
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-medium text-foreground">Large — Charcoal</span>
<span class="mt-0.5 block break-words text-sm text-muted-foreground">Restocking. Notify me is on the product page.</span>
</span>
<span class="shrink-0 rounded-full px-2.5 py-1 text-xs font-medium bg-destructive/10 text-destructive">out</span>
</button>
</li>
<li>
<button type="button" aria-pressed="false" class="flex w-full items-center justify-between gap-4 px-5 py-4 text-start transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset ">
<span class="min-w-0 flex-1">
<span class="block truncate text-sm font-medium text-foreground">Small — Sand</span>
<span class="mt-0.5 block break-words text-sm text-muted-foreground">Made to order. Six weeks, stated here rather than at checkout.</span>
</span>
<span class="shrink-0 rounded-full px-2.5 py-1 text-xs font-medium bg-muted text-muted-foreground">6 weeks</span>
</button>
</li>
</ul>
</div>
</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.
A "you might also like" row on native scroll-snap — touch swiping, momentum and keyboard support for free, with no carousel library.
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.
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.