Product Card Grid
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.
components/product-filter-sidebar.tsxnpx hoverlab add product-filter-sidebar
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.
'use client'
/**
* <ProductFilterSidebar> — faceted filters for a collection page.
*
* Each facet group is a <fieldset> with a <legend>, which is what makes a
* screen reader announce "Size, group" before reading the options instead
* of reciting twelve unattached checkboxes. It is the single most-skipped
* bit of markup in filter UIs.
*
* Colour swatches carry a visible label as well as the colour. A swatch row
* that conveys its options by hue alone is unusable for anyone who cannot
* distinguish them, and "Sage" is more precise than a green square anyway.
*
* The applied count and the Clear control are pinned at the top rather than
* the bottom: after selecting four facets the user is at the top of the
* panel, and that is where they look to undo it.
*/
import * as React from 'react'
import { X } from 'lucide-react'
export interface FacetOption {
value: string
label: string
count?: number
/** Tailwind background class, for colour facets. */
swatch?: string
}
export interface Facet {
id: string
legend: string
type: 'checkbox' | 'swatch'
options: FacetOption[]
}
export interface ProductFilterSidebarProps {
facets?: Facet[]
maxPrice?: number
currency?: string
onChange?: (selected: Record<string, string[]>) => void
className?: string
}
const DEFAULT_FACETS: Facet[] = [
{
id: 'category',
legend: 'Category',
type: 'checkbox',
options: [
{ value: 'knitwear', label: 'Knitwear', count: 24 },
{ value: 'shirts', label: 'Shirts', count: 31 },
{ value: 'outerwear', label: 'Outerwear', count: 12 },
{ value: 'accessories', label: 'Accessories', count: 47 },
],
},
{
id: 'size',
legend: 'Size',
type: 'checkbox',
options: [
{ value: 's', label: 'Small', count: 62 },
{ value: 'm', label: 'Medium', count: 88 },
{ value: 'l', label: 'Large', count: 74 },
{ value: 'xl', label: 'Extra large', count: 29 },
],
},
{
id: 'colour',
legend: 'Colour',
type: 'swatch',
options: [
{ value: 'stone', label: 'Stone', swatch: 'bg-stone-400' },
{ value: 'navy', label: 'Navy', swatch: 'bg-indigo-800' },
{ value: 'sage', label: 'Sage', swatch: 'bg-emerald-600' },
{ value: 'rust', label: 'Rust', swatch: 'bg-orange-700' },
{ value: 'black', label: 'Black', swatch: 'bg-zinc-900' },
],
},
]
export function ProductFilterSidebar({
facets = DEFAULT_FACETS,
maxPrice = 250,
currency = '£',
onChange,
className = '',
}: ProductFilterSidebarProps) {
const [selected, setSelected] = React.useState<Record<string, string[]>>({})
const [price, setPrice] = React.useState(maxPrice)
const appliedCount = Object.values(selected).reduce((n, list) => n + list.length, 0)
function toggle(facetId: string, value: string) {
setSelected((prev) => {
const current = prev[facetId] ?? []
const next = current.includes(value)
? current.filter((v) => v !== value)
: [...current, value]
const updated = { ...prev, [facetId]: next }
if (next.length === 0) delete updated[facetId]
onChange?.(updated)
return updated
})
}
function clearAll() {
setSelected({})
setPrice(maxPrice)
onChange?.({})
}
return (
<aside className={`w-full ${className}`}>
<div className="flex items-center justify-between gap-3 border-b border-border/60 pb-3">
<h2 className="font-semibold tracking-tight">
Filters
{appliedCount > 0 ? (
<span className="ms-2 rounded-full bg-primary/15 px-2 py-0.5 text-xs font-semibold text-primary">
{appliedCount}
</span>
) : null}
</h2>
{appliedCount > 0 ? (
<button
type="button"
onClick={clearAll}
className="inline-flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground"
>
<X aria-hidden className="h-3.5 w-3.5" />
Clear
</button>
) : null}
</div>
<div className="divide-y divide-border/40">
{facets.map((facet) => (
<fieldset key={facet.id} className="py-4">
<legend className="mb-2.5 text-sm font-medium">{facet.legend}</legend>
{facet.type === 'swatch' ? (
<div className="flex flex-wrap gap-2">
{facet.options.map((option) => {
const checked = selected[facet.id]?.includes(option.value) ?? false
return (
<label
key={option.value}
className={`flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors ${
checked
? 'border-primary bg-primary/10 text-foreground'
: 'border-border/60 text-muted-foreground hover:text-foreground'
}`}
>
<input
type="checkbox"
checked={checked}
onChange={() => toggle(facet.id, option.value)}
className="sr-only"
/>
<span aria-hidden className={`h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border ${option.swatch}`} />
{/* The name, not just the colour. */}
{option.label}
</label>
)
})}
</div>
) : (
<ul className="space-y-2">
{facet.options.map((option) => {
const checked = selected[facet.id]?.includes(option.value) ?? false
return (
<li key={option.value}>
<label className="flex cursor-pointer items-center gap-2.5 text-sm">
<input
type="checkbox"
checked={checked}
onChange={() => toggle(facet.id, option.value)}
className="h-4 w-4 rounded border-border/60 accent-primary"
/>
<span className="flex-1 text-muted-foreground">{option.label}</span>
{typeof option.count === 'number' ? (
<span className="text-xs text-muted-foreground/60">{option.count}</span>
) : null}
</label>
</li>
)
})}
</ul>
)}
</fieldset>
))}
<fieldset className="py-4">
<legend className="mb-2.5 text-sm font-medium">Maximum price</legend>
<input
type="range"
min={0}
max={maxPrice}
value={price}
onChange={(e) => setPrice(Number(e.target.value))}
aria-label="Maximum price"
className="w-full accent-primary"
/>
<p className="mt-1.5 text-sm text-muted-foreground">
Up to{' '}
<span className="font-medium text-foreground">
{currency}
{price}
</span>
</p>
</fieldset>
</div>
</aside>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/product-filter-sidebar.tsx and import it where you need the section:
import { ProductFilterSidebar } from '@/components/product-filter-sidebar'2 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 |
|---|---|---|
facets | Facet[] | DEFAULT_FACETS |
maxPrice | number | 250 |
currency | string | '£' |
onChange | (selected: Record<string, string[]>) => void | — |
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.
<!--
Faceted Filter Sidebar — 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.
-->
<aside class="w-full ">
<div class="flex items-center justify-between gap-3 border-b border-border/60 pb-3">
<h2 class="font-semibold tracking-tight">Filters</h2>
</div>
<div class="divide-y divide-border/40">
<fieldset class="py-4">
<legend class="mb-2.5 text-sm font-medium">Category</legend>
<ul class="space-y-2">
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Knitwear</span>
<span class="text-xs text-muted-foreground/60">24</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Shirts</span>
<span class="text-xs text-muted-foreground/60">31</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Outerwear</span>
<span class="text-xs text-muted-foreground/60">12</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Accessories</span>
<span class="text-xs text-muted-foreground/60">47</span>
</label>
</li>
</ul>
</fieldset>
<fieldset class="py-4">
<legend class="mb-2.5 text-sm font-medium">Size</legend>
<ul class="space-y-2">
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Small</span>
<span class="text-xs text-muted-foreground/60">62</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Medium</span>
<span class="text-xs text-muted-foreground/60">88</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Large</span>
<span class="text-xs text-muted-foreground/60">74</span>
</label>
</li>
<li>
<label class="flex cursor-pointer items-center gap-2.5 text-sm">
<input type="checkbox" class="h-4 w-4 rounded border-border/60 accent-primary" />
<span class="flex-1 text-muted-foreground">Extra large</span>
<span class="text-xs text-muted-foreground/60">29</span>
</label>
</li>
</ul>
</fieldset>
<fieldset class="py-4">
<legend class="mb-2.5 text-sm font-medium">Colour</legend>
<div class="flex flex-wrap gap-2">
<label class="flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors border-border/60 text-muted-foreground hover:text-foreground"><input type="checkbox" class="sr-only" /><span aria-hidden="true" class="h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border bg-stone-400"></span>Stone</label>
<label class="flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors border-border/60 text-muted-foreground hover:text-foreground"><input type="checkbox" class="sr-only" /><span aria-hidden="true" class="h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border bg-indigo-800"></span>Navy</label>
<label class="flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors border-border/60 text-muted-foreground hover:text-foreground"><input type="checkbox" class="sr-only" /><span aria-hidden="true" class="h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border bg-emerald-600"></span>Sage</label>
<label class="flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors border-border/60 text-muted-foreground hover:text-foreground"><input type="checkbox" class="sr-only" /><span aria-hidden="true" class="h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border bg-orange-700"></span>Rust</label>
<label class="flex cursor-pointer items-center gap-1.5 rounded-full border px-2 py-1 text-xs transition-colors border-border/60 text-muted-foreground hover:text-foreground"><input type="checkbox" class="sr-only" /><span aria-hidden="true" class="h-3.5 w-3.5 rounded-full border border-transparent ring-1 ring-border bg-zinc-900"></span>Black</label>
</div>
</fieldset>
<fieldset class="py-4">
<legend class="mb-2.5 text-sm font-medium">Maximum price</legend>
<input type="range" min="0" max="250" aria-label="Maximum price" class="w-full accent-primary" value="250" />
<p class="mt-1.5 text-sm text-muted-foreground">Up to <span class="font-medium text-foreground">£250</span></p>
</fieldset>
</div>
</aside>
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.
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.
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.