1---2name: tailwind-ecommerce3description: Use when building ecommerce interfaces, product pages, shopping carts, checkout flows, order management, or store navigation with Tailwind CSS. Covers product cards, product lists, product detail pages, category filters, shopping cart, checkout forms, order summaries, order history, pricing displays, promo sections, reviews, ratings, store navigation, category previews, inventory badges, wishlist buttons, compare features.4---56# Ecommerce UI with Tailwind CSS78Patterns for product display, cart, checkout, orders, and store navigation.910---1112## 1. Product Display Patterns1314### Card Variants1516| Variant | Key Classes | Use Case |17|---------|-------------|----------|18| Simple grid card | `aspect-[3/4] w-full object-cover` + text below image | Category pages, minimal listings |19| Card with details | `rounded-lg border bg-white shadow-sm` + price, rating, badge | Product listings, search results |20| Horizontal card | `flex flex-row gap-4` + image left, details right | Cart items, wishlists, comparisons |21| Quick view overlay | `group relative` + `opacity-0 group-hover:opacity-100` overlay CTA | Browse-and-add flows |22| Featured card | `col-span-2 row-span-2` + larger image | Homepage hero products |2324### Image Handling2526| Concern | Pattern | Classes |27|---------|---------|---------|28| Aspect ratio | Fixed ratio container | `aspect-square`, `aspect-[3/4]`, `aspect-[4/3]` |29| Fill behavior | Cover without distortion | `object-cover w-full h-full` |30| Responsive sizing | Fluid width, fixed aspect | `w-full` on container, aspect ratio on `<img>` |31| Placeholder | Background color fallback | `bg-gray-100` on container |32| Hover zoom | Scale on group hover | `transition-transform duration-300 group-hover:scale-105` |33| Lazy loading | Native attribute | `loading="lazy"` on `<img>` |3435### Price Display3637| Scenario | Pattern |38|----------|---------|39| Regular price | `<span class="text-lg font-semibold text-gray-900">$49.99</span>` |40| Sale price | Original: `line-through text-gray-500 text-sm` / Sale: `text-lg font-semibold text-red-600` |41| Price range | `From $29.99` with `text-sm text-gray-500` prefix |42| Currency symbol | Keep symbol adjacent, no wrapping: `whitespace-nowrap` |4344### Rating Display4546| Element | Classes |47|---------|---------|48| Star icon (filled) | `size-4 text-yellow-400 fill-current` |49| Star icon (empty) | `size-4 text-gray-300 fill-current` |50| Half star | Clip filled star at 50% with `overflow-hidden w-2` wrapper |51| Review count | `text-sm text-gray-500 ml-1` next to stars |52| Container | `flex items-center gap-0.5` |5354---5556## 2. Product List Layouts5758### Responsive Grid5960```html61<div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">62 <!-- Product cards -->63</div>64```6566### Layout Patterns6768| Layout | Classes | When to Use |69|--------|---------|-------------|70| Grid (default) | `grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6` | Category pages, search results |71| Two-column wide | `grid grid-cols-1 md:grid-cols-2 gap-8` | Featured products, comparisons |72| List view | `flex flex-col divide-y` with horizontal cards | Detail-heavy browsing |73| Masonry-style | `columns-2 lg:columns-3 gap-4` | Visual-heavy catalogs |7475### Loading and Pagination7677| Pattern | Implementation |78|---------|---------------|79| Skeleton card | `animate-pulse` with `bg-gray-200 rounded` blocks matching card layout |80| Skeleton image | `aspect-[3/4] bg-gray-200 rounded-lg animate-pulse` |81| Skeleton text | `h-4 bg-gray-200 rounded w-3/4 animate-pulse` |82| Load more button | `w-full py-3 border rounded-lg text-center` below grid |83| Pagination | `flex items-center gap-2` with numbered buttons, active: `bg-indigo-600 text-white` |84| Infinite scroll | Intersection observer on sentinel div at grid end |85| Empty state | `text-center py-16` with icon, heading, and CTA |8687---8889## 3. Category and Filtering9091### Sidebar Filter Panel (Desktop)9293| Element | Classes |94|---------|---------|95| Panel container | `w-64 shrink-0 hidden lg:block` |96| Filter group | `border-b py-4` with heading + options |97| Group heading | `font-medium text-sm text-gray-900 mb-3` |98| Checkbox + label | `flex items-center gap-2 text-sm text-gray-600` |99| Color swatch | `size-6 rounded-full border-2` + `ring-2 ring-offset-2 ring-indigo-500` when active |100| Price range | Two `input[type=number]` with `w-20` in a `flex gap-2 items-center` row |101| Apply button | `w-full mt-3 py-2 bg-indigo-600 text-white rounded-lg text-sm` |102103### Mobile Filter (Slide-out Dialog)104105| Element | Classes |106|---------|---------|107| Trigger button | `lg:hidden flex items-center gap-2 border rounded-lg px-4 py-2` |108| Backdrop | `fixed inset-0 bg-black/25 z-40` |109| Panel | `fixed inset-y-0 right-0 w-full max-w-sm bg-white z-50 overflow-y-auto` |110| Header | `flex items-center justify-between px-4 py-3 border-b` |111| Footer | `sticky bottom-0 bg-white border-t px-4 py-3` with Apply/Clear buttons |112113### Active Filters and Sorting114115| Element | Classes |116|---------|---------|117| Filter chip | `inline-flex items-center gap-1 rounded-full bg-gray-100 px-3 py-1 text-sm` |118| Remove button | `size-4 text-gray-400 hover:text-gray-600` (X icon inside chip) |119| Clear all link | `text-sm text-indigo-600 hover:text-indigo-800` |120| Sort dropdown | `select` or custom dropdown, `text-sm border rounded-lg px-3 py-2` |121| Result count | `text-sm text-gray-500` (e.g., "128 products") |122| Filter count badge | `size-5 rounded-full bg-indigo-600 text-white text-xs flex items-center justify-center` |123124---125126## 4. Shopping Cart127128### Cart Item Row129130```html131<div class="flex gap-4 py-4 border-b">132 <img class="size-20 rounded-lg object-cover shrink-0" src="..." alt="..." />133 <div class="flex flex-1 flex-col justify-between">134 <div class="flex justify-between">135 <div>136 <h3 class="text-sm font-medium text-gray-900">Product Name</h3>137 <p class="mt-1 text-sm text-gray-500">Color / Size</p>138 </div>139 <p class="text-sm font-medium text-gray-900">$49.99</p>140 </div>141 <div class="flex items-center justify-between">142 <!-- Quantity selector -->143 <div class="flex items-center rounded-lg border">144 <button class="px-3 py-1 text-gray-600">-</button>145 <span class="px-3 py-1 border-x text-sm">1</span>146 <button class="px-3 py-1 text-gray-600">+</button>147 </div>148 <button class="text-sm text-red-600 hover:text-red-800">Remove</button>149 </div>150 </div>151</div>152```153154### Cart Sections155156| Section | Classes | Content |157|---------|---------|---------|158| Cart list | `divide-y` | Cart item rows |159| Summary panel | `rounded-lg bg-gray-50 p-6 lg:w-80 lg:shrink-0` | Subtotal, shipping, tax, total |160| Summary row | `flex justify-between text-sm text-gray-600 py-2` | Label + amount |161| Total row | `flex justify-between text-base font-semibold text-gray-900 border-t pt-4 mt-4` | Total label + amount |162| Checkout CTA | `w-full mt-6 py-3 bg-indigo-600 text-white rounded-lg font-medium` | "Proceed to Checkout" |163| Continue shopping | `text-sm text-indigo-600 hover:text-indigo-800 mt-4 text-center block` | Link back |164165### Cart States166167| State | Pattern |168|-------|---------|169| Empty cart | `text-center py-16` with cart icon, "Your cart is empty" heading, shop CTA |170| Mini cart / drawer | `fixed inset-y-0 right-0 w-full max-w-md bg-white shadow-xl z-50` |171| Cart badge | `absolute -top-2 -right-2 size-5 rounded-full bg-indigo-600 text-white text-xs flex items-center justify-center` |172| Updating state | `opacity-50 pointer-events-none` on item row during async update |173174---175176## 5. Checkout Flow177178### Progress Indicator179180| Step State | Classes |181|------------|---------|182| Completed | `size-8 rounded-full bg-indigo-600 text-white` with check icon |183| Current | `size-8 rounded-full border-2 border-indigo-600 text-indigo-600` |184| Upcoming | `size-8 rounded-full border-2 border-gray-300 text-gray-400` |185| Connector (done) | `h-0.5 w-full bg-indigo-600` between circles |186| Connector (pending) | `h-0.5 w-full bg-gray-300` between circles |187| Container | `flex items-center justify-between max-w-lg mx-auto mb-8` |188189### Form Layout190191| Section | Structure |192|---------|-----------|193| Two-column layout | `grid grid-cols-1 lg:grid-cols-5 gap-8` (3 cols form + 2 cols summary) |194| Field group | `space-y-4` container |195| Two-field row | `grid grid-cols-2 gap-4` (first/last name, city/zip) |196| Full-width field | `col-span-2` or standalone |197| Label | `block text-sm font-medium text-gray-700 mb-1` |198| Input | `w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500` |199| Error input | `border-red-500 focus:border-red-500 focus:ring-red-500` |200| Error message | `text-sm text-red-600 mt-1` |201202### Payment Fields203204| Element | Pattern |205|---------|---------|206| Card number | Full-width input with card icon right-aligned |207| Expiry + CVC | `grid grid-cols-2 gap-4` side by side |208| Card group | `rounded-lg border divide-y` wrapping all card fields as one visual unit |209| Saved cards | Radio group: `flex items-center gap-3 p-4 border rounded-lg` per card |210| Security note | `flex items-center gap-2 text-sm text-gray-500` with lock icon |211212### Checkout Patterns213214| Pattern | Implementation |215|---------|---------------|216| Guest vs account | Toggle or tabs at top: `flex rounded-lg border` with two options |217| Order review | Summary card: item thumbnails, quantities, line totals in `bg-gray-50 rounded-lg p-6` |218| Place order CTA | `w-full py-3 bg-indigo-600 text-white rounded-lg font-medium text-lg` |219| Terms checkbox | `flex items-start gap-2` with checkbox and label text |220| Loading on submit | Button with `opacity-75 cursor-not-allowed` + spinner icon |221222---223224## 6. Order Management225226### Order History Table227228| Viewport | Pattern |229|----------|---------|230| Desktop | Standard `<table>` with columns: Order #, Date, Status, Total, Actions |231| Mobile | Stacked cards: `divide-y` with each order as a `flex flex-col gap-2 py-4` block |232| Table header | `text-left text-sm font-medium text-gray-500 pb-3 border-b` |233| Table cell | `py-4 text-sm text-gray-900` |234235### Order Status Badges236237| Status | Classes |238|--------|---------|239| Pending | `bg-yellow-100 text-yellow-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |240| Processing | `bg-blue-100 text-blue-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |241| Shipped | `bg-indigo-100 text-indigo-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |242| Delivered | `bg-green-100 text-green-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |243| Cancelled | `bg-red-100 text-red-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |244| Refunded | `bg-gray-100 text-gray-800 rounded-full px-2.5 py-0.5 text-xs font-medium` |245246### Order Detail Page247248| Section | Pattern |249|---------|---------|250| Status timeline | Vertical: `relative pl-8 space-y-6` with `absolute left-0` circles and connecting line |251| Timeline dot (done) | `size-4 rounded-full bg-indigo-600` |252| Timeline dot (current) | `size-4 rounded-full border-2 border-indigo-600 bg-white` |253| Timeline line | `absolute left-2 top-4 bottom-0 w-0.5 bg-gray-200` |254| Items list | Horizontal cards with image, name, qty, price |255| Totals section | Same pattern as cart summary |256| Shipping address | `bg-gray-50 rounded-lg p-4` card |257| Invoice layout | `max-w-2xl mx-auto` with logo header, address block, items table, totals |258259---260261## 7. Pricing and Promotions262263### Price Patterns264265| Pattern | Implementation |266|---------|---------------|267| Original + sale | `<span class="line-through text-gray-500 text-sm">$99.99</span> <span class="text-lg font-semibold text-red-600">$49.99</span>` |268| Save amount | `<span class="text-sm text-green-600 font-medium">Save $50.00 (50%)</span>` |269| Per-unit price | `<span class="text-xs text-gray-500">$2.50/oz</span>` below main price |270271### Discount Badge (on Product Image)272273```html274<div class="relative">275 <img class="aspect-[3/4] w-full rounded-lg object-cover" src="..." alt="..." />276 <span class="absolute top-2 left-2 rounded-full bg-red-600 px-2.5 py-0.5 text-xs font-semibold text-white">277 -50%278 </span>279</div>280```281282### Pricing Tier Cards283284| Element | Classes |285|---------|---------|286| Card container | `rounded-xl border p-6 text-center` |287| Featured card | `border-indigo-600 ring-2 ring-indigo-600 relative` with "Popular" badge |288| Price | `text-4xl font-bold text-gray-900` |289| Period | `text-sm text-gray-500` (e.g., "/month") |290| Feature list | `space-y-3 text-sm text-gray-600` with check icons |291| CTA button | `w-full mt-6 py-2.5 rounded-lg font-medium` |292293### Promo and Incentive Sections294295| Pattern | Classes |296|---------|---------|297| Full-width banner | `bg-indigo-600 text-white py-3 text-center text-sm font-medium` |298| Dismissable banner | Add `flex items-center justify-between px-4` with close button |299| Trust icons row | `grid grid-cols-2 md:grid-cols-4 gap-6 py-8 text-center` |300| Trust icon item | `flex flex-col items-center gap-2 text-sm text-gray-600` with icon above |301| Coupon input | `flex` with `flex-1 rounded-l-lg border px-3 py-2` input + `rounded-r-lg bg-gray-900 text-white px-4 py-2` button |302303---304305## 8. Store Navigation306307### Store Header308309| Element | Classes |310|---------|---------|311| Header bar | `sticky top-0 z-30 bg-white border-b` |312| Inner layout | `flex items-center justify-between h-16 px-4 max-w-7xl mx-auto` |313| Logo | `shrink-0` |314| Search bar | `flex-1 max-w-lg mx-8 hidden md:block` with `rounded-full bg-gray-100 px-4 py-2` |315| Icon group | `flex items-center gap-4` for account, wishlist, cart icons |316| Cart icon + badge | `relative` button with `absolute -top-1.5 -right-1.5` badge |317318### Mega Menu319320| Element | Classes |321|---------|---------|322| Trigger | `group` on nav item |323| Dropdown | `invisible group-hover:visible opacity-0 group-hover:opacity-100 transition-all absolute left-0 w-full bg-white shadow-lg border-t` |324| Inner grid | `grid grid-cols-4 gap-8 max-w-7xl mx-auto p-8` |325| Column heading | `font-medium text-sm text-gray-900 mb-3` |326| Column links | `space-y-2 text-sm text-gray-600` |327| Featured image | `rounded-lg overflow-hidden` in last column |328329### Category Previews and Breadcrumbs330331| Element | Classes |332|---------|---------|333| Category card | `group relative rounded-xl overflow-hidden` |334| Category image | `aspect-[4/3] w-full object-cover transition-transform group-hover:scale-105` |335| Category overlay | `absolute inset-0 bg-gradient-to-t from-black/60 to-transparent` |336| Category label | `absolute bottom-4 left-4 text-lg font-semibold text-white` |337| Breadcrumb nav | `flex items-center gap-2 text-sm text-gray-500` |338| Breadcrumb separator | `size-4 text-gray-400` (chevron icon) |339| Breadcrumb current | `text-gray-900 font-medium` (last item, no link) |340341---342343## 9. Accessibility for Ecommerce344345| Element | Requirement | Implementation |346|---------|-------------|----------------|347| Product image | Descriptive alt text | `alt="Red leather crossbody bag"` not `alt="product"` |348| Decorative image | Skip for screen readers | `alt=""` and `aria-hidden="true"` |349| Sale price | Announce was/now | `aria-label="Sale price $49.99, originally $99.99"` on container |350| Cart update | Announce change | `aria-live="polite"` region for "Item added" / "Cart updated" messages |351| Cart count badge | Announce count | `aria-label="Cart, 3 items"` on cart button |352| Quantity selector | Label buttons | `aria-label="Decrease quantity"` / `aria-label="Increase quantity"` |353| Star rating | Text alternative | `aria-label="4 out of 5 stars"` on rating container |354| Filter change | Announce results | `aria-live="polite"` on product count ("128 results") |355| Form errors | Link to field | `aria-describedby="email-error"` on input, matching `id` on error text |356| Checkout steps | Current step | `aria-current="step"` on active step indicator |357| Remove from cart | Confirm action | Identify item in label: `aria-label="Remove Red Bag from cart"` |358| Sort dropdown | Label purpose | `aria-label="Sort products by"` on select element |359| Color swatch | Name the color | `aria-label="Color: Navy Blue"` on swatch button |360| Dialog filters | Trap focus | `role="dialog"` + `aria-modal="true"` + focus trap on mobile filter panel |361362---363364## Common Mistakes365366| Mistake | Fix |367|---------|-----|368| Fixed pixel image heights | Use `aspect-*` utilities with `object-cover` for responsive images |369| Cart with no empty state | Always handle zero items with illustration and CTA |370| Price without `whitespace-nowrap` | Currency and amount should not wrap to separate lines |371| Filter panel always visible on mobile | Hide with `hidden lg:block`, use dialog for mobile |372| No loading state during cart updates | Show `opacity-50 pointer-events-none` or skeleton on async actions |373| Checkout form in single column | Use `grid grid-cols-2 gap-4` for name, city/zip, expiry/CVC pairs |374| Status badges with only color | Add text labels; color alone fails WCAG |375| Missing `aria-live` on cart | Cart count and summary changes must announce to screen readers |376| Mega menu not keyboard-navigable | Ensure focus management and Escape key closes the menu |377| Discount badge over product text | Position badge on image (`absolute top-2 left-2`), not over card text |378379## MCP Component Library380381The `frontend-components` MCP server provides ecommerce-related components:382383- **HyperUI** (`hyperui`): Product cards, product collections, pricing tables, forms, badges, stats384- **DaisyUI** (`daisyui`): Card, badge, stat, table, modal, rating, countdown class references385- **FlyonUI** (`flyonui`): Card, badge, stat, table CSS components + datatable JS plugin386387**Ecommerce search:** `search_components(query: "product", framework: "hyperui")` or `search_components(query: "pricing")` for pricing components across all libraries.