Trek FX 2 city bike
28" wheels · 3 speeds · Frame M
Portland, Pearl District, 4.2 km away
Commerce
Listing card
v1.0.0Added in 1.0.0
A React listing card for marketplaces: swipeable photos, price, place and time, badges and a heart, in grid, list and compact layouts.
Tap or click anywhere on the card to open the listing: the title is one link stretched over the whole card, so long-press and middle-click give the native link menu. Swipe the photos sideways on a phone (vertical scrolling always wins, and a swipe never opens the listing); with a mouse, drag them or use the arrows that appear on hover, and the photo zooms in a touch. Tap the heart to save the listing: it pops with a small burst, and rolls back with a shake if saving fails. Keyboard: Tab meets the title link, the photo arrows (they show while the card holds focus) and the heart once each; Left / Right change the photo while focus is on the photo's controls; Enter opens the listing, Space or Enter toggles the heart. Dots under the photo show where you are (at most five, sliding along); a camera chip tells how many photos there are when not all of them are in the card. The first photo is a plain image until you touch, hover or focus it, so a grid of 48 cards stays light; under reduced motion the photo does not zoom.
Listing card is a Pro React component in the React commerce components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add listing-card, together with Avatar, Badge, Card, Carousel, Favorite button and 10 more and the npm package lucide-react.
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add listing-cardListing card is part of Pro, with 298 more Pro items: $8 a month or $150 once. 14-day refund before you download any Pro item. See plans
Import ListingCard from @/components/ui/listing-card.
import { ListingCard, type ListingData } from "@/components/ui/listing-card"
const bike: ListingData = {
id: "l01",
title: "Trek FX 2 city bike",
href: "/listings/l01",
images: ["/demo/bicycle.jpg"],
price: 280,
currency: "USD",
priceType: "negotiable",
location: "Portland, Pearl District",
postedAt: "2026-09-24T14:32:00",
delivery: true,
condition: "used",
seller: { name: "Daniel Reed", verified: true, rating: 4.8 },
}
export function SearchResult({ onSave }: { onSave: (id: string, saved: boolean) => Promise<void> }) {
return (
<ListingCard
listing={bike}
size="sm"
showSeller
locale="en-US"
onFavoriteChange={(saved, listing) => onSave(listing.id, saved)}
labels={{ delivery: "Ships", price: { negotiable: "OBO" } }}
/>
)
}listing*ListingDataThe ad: { id, title, href?, images?: (string | { src, alt?, width?, height? })[], price (null: on request), currency?, compareAtPrice?, priceType?, priceSuffix?, unit?: { quantity, unit }, location?, distanceKm?, postedAt?, promoted?, delivery?, condition?: "new" | "used", attributes?: string[], badges?: { label, tone?, icon? }[], seller?: { name, avatar?, business?, verified?, rating? }, status?: "active" | "reserved" | "sold" | "expired", favorite?, favoriteCount? }.
layoutdefault "grid""grid" | "list" | "compact"grid: the photo on top (result grids). list: the photo at the start, a 112px square while the card is narrow and 240px wide in imageAspect once the card is 560px wide (search results). compact: a 64px thumbnail row with no carousel and no distance (recently viewed, a seller's other listings). ListingCardSkeleton (see Parts) has the same layouts for loading states.
variantdefault "elevated""elevated" | "outline" | "soft" | "ghost"The card surfaces: a raised panel, a hairline frame or the flat gray tile. ghost has no surface: a rounded photo with the text under it, like a fashion grid.
sizedefault "md""sm" | "md" | "lg"Paddings, title and price size. sm is for two-column phone grids, lg for a featured listing.
radiusdefault "md""sm" | "md" | "lg"Card corners: 12 / 16 / 24px. The photo of a list row or a ghost card takes the matching inner corner.
imageAspectdefault "4/3""1/1" | "4/3" | "3/2" | "16/10" | "3/4"The photo box in grid and list layouts (list rows stay square on phones). 3/4 suits fashion, 16/10 cars and homes.
maxImagesdefault 5numberPhotos in the card's carousel. 1 shows a single photo with no swipe: use it for cards inside horizontal rails, which must never nest a carousel. When the listing has more photos, a camera chip shows the real total.
showDotsdefault truebooleanDots under the photo (at most five, sliding along with the photo), over a soft shade so they read on any image.
showArrowsdefault truebooleanPrevious / next buttons on the photo. They appear while the card is hovered or holds focus, on fine pointers only (phones swipe).
showFavoritedefault truebooleanThe heart: round glass on the photo in the grid layout, a plain icon button at the end of list and compact rows.
defaultFavoritedefault falsebooleanStarts saved (uncontrolled). Falls back to listing.favorite.
favoritebooleanControlled saved state; pair it with onFavoriteChange.
onFavoriteChange((favorite: boolean, listing: ListingData) => void | Promise<unknown>)Called when the heart toggles. Return a promise to keep the heart in its new state while it is pending; a rejection rolls it back, shakes it and announces the error.
favoriteTonedefault "neutral""neutral" | "brand" | "success" | "warning" | "danger" | "info"The saved heart's color. Neutral is white on photos and black / white elsewhere; danger gives the classic red heart.
showBadgesdefault truebooleanThe promoted chip on the photo and the small badges under the text: delivery, new or used, business seller and listing.badges.
showAttributesdefault truebooleanThe attributes line ("2019 · 51,000 mi · Gasoline"): one line in grids, up to two in list rows.
showSellerdefault falsebooleanThe seller line: a small avatar, the name, a check when verified and the rating. In grids it sits at the bottom, over a hairline.
promotedStyledefault "badge""badge" | "ring" | "both"How a promoted listing stands out: a labelled chip on the photo, a 2px ring in promotedTone around the card, or both.
promotedTonedefault "warning""neutral" | "brand" | "success" | "warning" | "danger" | "info"The promoted chip and ring color. Promotion is a status, so it defaults to the amber warning tone; the chip always says it in words.
timeFormatdefault "day""day" | "relative" | "date"day: "Today at 2:32 PM", "Yesterday at 9:10 AM", then "Sep 22" this year and the full date before. relative: "2 hours ago". date: the short numeric date. The full date and time is in the tooltip. formatListingTime (see Parts) prints the same text outside the card.
prioritydefault falsebooleanLoads the first photo eagerly with high fetch priority. Set it on the first row of a grid; every other photo loads lazily.
localedefault ""stringFormats the price, distance and time ("$1,200", "4.2 km", "2:32 PM" in en-US). Empty uses the UIProvider locale, then the page.
hrefdefault ""stringWhere the card leads; empty uses listing.href. Rendered through linkComponent, so a Next.js Link keeps client navigation. The playground's pretend router prints it.
onSelect(listing: ListingData) => voidWithout an href, the title becomes a button that calls it (and a click anywhere on the card does too). Without both, the card is not interactive.
actionsReactNodeControls at the top end of the text ("⋯" on your own listings, an edit button). They sit above the stretched link, so a click on them never opens the listing.
nowdefault "useNow()"number | nullThe reference time in ms for "Today at 2:32 PM". Pass the page's clock (one useNow() in the grid) so the cards re-render with it; without it every card on the page shares one minute timer (not one each). null prints dates.
linkComponent(props: LinkComponentProps) => ReactNodeThe router link for the title and the photos. Defaults to the one given to LinkProvider (lib/navigation), else a plain <a>.
labelsPartial<ListingCardLabels>Copy, English by default: promoted, delivery, new, used, business, verified, reserved, sold, expired, today, yesterday, at, photo(title, i, n) (alt text), photos(n), noImage, distance(formatted), previous, next, rating(formatted), plus price (forwarded PriceLabels) and favorite (forwarded FavoriteButtonLabels). Pass only the keys you translate.
classNamesPartial<Record<"media" | "image" | "carousel" | "dots" | "favorite" | "body" | "title" | "price" | "attributes" | "meta" | "tags" | "seller" | "actions" | "status", string>>Extra classes for the inner parts.
classNamestringExtra classes for the card (the <article>), merged last.
The loading placeholder with the card's exact shape: the photo block, a price bar, the title lines and a meta line. Takes layout, variant, size, radius and imageAspect like the card.
layoutdefault "grid""grid" | "list" | "compact"Matches the card layout it stands in for.
variantdefault "elevated""elevated" | "outline" | "soft" | "ghost"Matches the card surface.
sizedefault "md""sm" | "md" | "lg"Matches the card size.
radiusdefault "md""sm" | "md" | "lg"Matches the card corners.
imageAspectdefault "4/3""1/1" | "4/3" | "3/2" | "16/10" | "3/4"Aspect ratio of the photo block.
linesdefault 3numberText bars under the price: the title lines, then the meta line.
announcedefault truebooleanWraps it in a role="status" region named by label. Turn off inside a grid that announces its own loading.
labeldefault "Loading"stringThe accessible name of the status region.
The card's time text as a function, for a detail page or a table: formatListingTime(value, { now, locale?, labels?, format? }) returns "Today at 2:32 PM", "Yesterday at 9:10 AM", "Sep 22" or the full date. With now null it prints the date, so server and browser agree.
The English copy of the card. Spread it into labels when you translate only a few keys.
One listing: id, title, href, images, price, currency, priceType, location, distanceKm, postedAt, promoted, delivery, condition, attributes, badges, status and an optional seller.
l01 to l08: two columns on phones with size sm, four on desktop, the first row loads eagerly.
Search-result rows with the attributes and the seller line; a square photo on phones.
A “Recently viewed” rail: compact rows with one photo each, so no carousel nests in the rail.
The same promoted listing with the chip, the ring and both.
Reserved, sold (the photo goes gray) and expired (the whole card dims), each with its chip.
Four skeletons with the card's shape, then the cards after 1.4s.
A large card with six photos, the unit price and its EUR twin.
No surface, a 3:4 photo and a red heart: a fashion grid, two columns on phones, with a ⋯ action on your own listing.
The preview, props and docs are free; copying the source needs a Pro plan. See plans.
Run npx wingo-ui@latest add listing-card. It also adds the Wingo UI items it builds on (Avatar, Badge, Card, Carousel, Favorite button and 10 more) and the npm package lucide-react. With shadcn, add the @wingo-ui registry with your API key, then run npx shadcn@latest add @wingo-ui/listing-card.
Swipe the photos sideways on a phone (vertical scrolling always wins, and a swipe never opens the listing); with a mouse, drag them or use the arrows that appear on hover, and the photo zooms in a touch.
Build it: screens and apps10 min read
Build it: screens and apps15 min read
Mobile UI in React9 min read
28" wheels · 3 speeds · Frame M
Portland, Pearl District, 4.2 km away
2 bedrooms · 580 sq ft · Floor 3/4 · Split plan
Brooklyn, Park Slope, 850 m away
router: /listings · favorite: none yet · maxImages 5 · first photo lazy
Swipe or drag the photos; tap anywhere else to open the listing