Product Card Grid
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.
components/collection-toolbar.tsxnpx hoverlab add collection-toolbar
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.
114 products
Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.
'use client'
/**
* <CollectionToolbar> — result count, sort and density for a product grid.
*
* The result count is `aria-live="polite"`. When a filter changes, the grid
* silently re-renders; for a screen-reader user the count is the only
* signal anything happened, and without the live region they are left
* arrowing through a list to find out whether it worked.
*
* Sort is a native <select>, not a custom dropdown. It is one of the few
* controls where the platform version is better on every axis that matters:
* keyboard, mobile, screen reader, and the amount of code you maintain.
*/
import * as React from 'react'
import { SlidersHorizontal, LayoutGrid, Rows3 } from 'lucide-react'
export interface SortOption {
value: string
label: string
}
export interface CollectionToolbarProps {
total?: number
sortOptions?: SortOption[]
onSort?: (value: string) => void
onDensity?: (density: 'comfortable' | 'compact') => void
/** Shown on small screens to open the filter drawer. */
onOpenFilters?: () => void
className?: string
}
const DEFAULT_SORT: SortOption[] = [
{ value: 'featured', label: 'Featured' },
{ value: 'newest', label: 'Newest' },
{ value: 'price-asc', label: 'Price: low to high' },
{ value: 'price-desc', label: 'Price: high to low' },
{ value: 'rating', label: 'Top rated' },
]
export function CollectionToolbar({
total = 114,
sortOptions = DEFAULT_SORT,
onSort,
onDensity,
onOpenFilters,
className = '',
}: CollectionToolbarProps) {
// Per-instance ids. A literal id in a reusable component is a
// collision waiting for the second copy on the page — and a <label>
// then resolves to whichever input rendered first.
const uid = React.useId()
const [density, setDensity] = React.useState<'comfortable' | 'compact'>('comfortable')
function changeDensity(next: 'comfortable' | 'compact') {
setDensity(next)
onDensity?.(next)
}
return (
<div
className={`flex flex-wrap items-center gap-3 border-b border-border/60 pb-4 ${className}`}
>
{/* The only feedback a filter change gives some users. */}
<p aria-live="polite" className="text-sm text-muted-foreground">
<span className="font-medium text-foreground">{total.toLocaleString('en-GB')}</span>{' '}
{total === 1 ? 'product' : 'products'}
</p>
<button
type="button"
onClick={onOpenFilters}
className="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-3 py-1.5 text-sm font-medium transition-colors hover:bg-muted lg:hidden"
>
<SlidersHorizontal aria-hidden className="h-4 w-4" />
Filters
</button>
<div className="ms-auto flex items-center gap-3">
<div className="flex items-center gap-2">
<label htmlFor={`${uid}-collection-sort`} className="text-sm text-muted-foreground">
Sort
</label>
{/* Native select — better than any custom dropdown here. */}
<select
id={`${uid}-collection-sort`}
onChange={(e) => onSort?.(e.target.value)}
className="rounded-xl border border-border/60 bg-background px-2.5 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-primary"
>
{sortOptions.map((option) => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</select>
</div>
<div
role="radiogroup"
aria-label="Grid density"
className="hidden rounded-xl border border-border/60 bg-background p-0.5 sm:flex"
>
{(
[
{ id: 'comfortable', icon: <LayoutGrid className="h-4 w-4" />, label: 'Comfortable' },
{ id: 'compact', icon: <Rows3 className="h-4 w-4" />, label: 'Compact' },
] as const
).map((option) => (
<button
key={option.id}
type="button"
role="radio"
aria-checked={density === option.id}
aria-label={`${option.label} density`}
onClick={() => changeDensity(option.id)}
className={`rounded-lg p-1.5 transition-colors ${
density === option.id
? 'bg-muted text-foreground'
: 'text-muted-foreground hover:text-foreground'
}`}
>
{option.icon}
</button>
))}
</div>
</div>
</div>
)
}
bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.Drop it at components/collection-toolbar.tsx and import it where you need the section:
import { CollectionToolbar } from '@/components/collection-toolbar'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 |
|---|---|---|
total | number | 114 |
sortOptions | SortOption[] | DEFAULT_SORT |
onSort | (value: string) => void | — |
onDensity | (density: 'comfortable' | 'compact') => void | — |
onOpenFiltersShown on small screens to open the filter drawer. | () => 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.
<!--
Collection Sort Toolbar — 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.
-->
<div class="flex flex-wrap items-center gap-3 border-b border-border/60 pb-4 ">
<p aria-live="polite" class="text-sm text-muted-foreground"><span class="font-medium text-foreground">114</span> products</p>
<button type="button" class="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-3 py-1.5 text-sm font-medium transition-colors hover:bg-muted lg:hidden"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sliders-horizontal h-4 w-4" aria-hidden="true"><line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line></svg>Filters</button>
<div class="ms-auto flex items-center gap-3">
<div class="flex items-center gap-2">
<label for="_R_0_-collection-sort" class="text-sm text-muted-foreground">Sort</label>
<select id="_R_0_-collection-sort" class="rounded-xl border border-border/60 bg-background px-2.5 py-1.5 text-sm outline-none focus-visible:ring-2 focus-visible:ring-primary">
<option value="featured">Featured</option>
<option value="newest">Newest</option>
<option value="price-asc">Price: low to high</option>
<option value="price-desc">Price: high to low</option>
<option value="rating">Top rated</option>
</select>
</div>
<div role="radiogroup" aria-label="Grid density" class="hidden rounded-xl border border-border/60 bg-background p-0.5 sm:flex">
<button type="button" role="radio" aria-checked="true" aria-label="Comfortable density" class="rounded-lg p-1.5 transition-colors bg-muted text-foreground">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-grid h-4 w-4" aria-hidden="true">
<rect width="7" height="7" x="3" y="3" rx="1"></rect>
<rect width="7" height="7" x="14" y="3" rx="1"></rect>
<rect width="7" height="7" x="14" y="14" rx="1"></rect>
<rect width="7" height="7" x="3" y="14" rx="1"></rect>
</svg>
</button>
<button type="button" role="radio" aria-checked="false" aria-label="Compact density" class="rounded-lg p-1.5 transition-colors text-muted-foreground hover:text-foreground">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rows3 lucide-rows-3 h-4 w-4" aria-hidden="true">
<rect width="18" height="18" x="3" y="3" rx="2"></rect>
<path d="M21 9H3"></path>
<path d="M21 15H3"></path>
</svg>
</button>
</div>
</div>
</div>
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.
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.