Product Listing
Shop grids — a sort/results toolbar above a responsive grid of product cards with sale badge, rating and add-to-cart.
Preview
@props([
'heading' => 'Trending now',
'viewAllHref' => '#',
'products' => null,
'currency' => 'USD',
])
@php
$products ??= [
['name' => 'Aero Knit Runner', 'category' => 'Footwear', 'price' => '118', 'compareAt' => '148', 'rating' => 5, 'reviews' => 214, 'sale' => 'Save 20%', 'gradient' => 'from-primary/20 via-muted to-muted'],
['name' => 'Merino Travel Crew', 'category' => 'Knitwear', 'price' => '96', 'compareAt' => null, 'rating' => 5, 'reviews' => 88, 'sale' => null, 'gradient' => 'from-secondary/30 via-muted to-muted'],
['name' => 'Cascade Shell', 'category' => 'Outerwear', 'price' => '214', 'compareAt' => '260', 'rating' => 4, 'reviews' => 132, 'sale' => 'Save $46', 'gradient' => 'from-accent/40 via-muted to-muted'],
['name' => 'Field Canvas Tote', 'category' => 'Accessories', 'price' => '72', 'compareAt' => null, 'rating' => 4, 'reviews' => 47, 'sale' => 'New', 'gradient' => 'from-primary/10 via-card to-card'],
['name' => 'Studio Linen Shirt', 'category' => 'Shirts', 'price' => '84', 'compareAt' => '110', 'rating' => 4, 'reviews' => 309, 'sale' => 'Sale', 'gradient' => 'from-muted via-muted/60 to-muted'],
['name' => 'Trail Insulated Bottle', 'category' => 'Gear', 'price' => '38', 'compareAt' => null, 'rating' => 5, 'reviews' => 521, 'sale' => null, 'gradient' => 'from-secondary/20 via-card to-card'],
];
@endphp
<x-ui.section space="lg" {{ $attributes }}>
<x-ui.container size="xl" gutter="sm">
<div class="flex items-center justify-between gap-4">
<h2 class="text-2xl font-bold tracking-tight sm:text-3xl">{{ __($heading) }}</h2>
<div class="flex shrink-0 items-center gap-2">
<a href="{{ $viewAllHref }}" class="hidden text-sm font-medium text-link underline-offset-4 hover:underline sm:inline-flex">{{ __('View all') }}</a>
<x-ui.button variant="outline" size="icon" type="button" aria-label="{{ __('Scroll left') }}">
<svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6" /></svg>
</x-ui.button>
<x-ui.button variant="outline" size="icon" type="button" aria-label="{{ __('Scroll right') }}">
<svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6" /></svg>
</x-ui.button>
</div>
</div>
<ul role="list" class="mt-6 flex snap-x snap-mandatory gap-4 overflow-x-auto scroll-px-4 pb-4">
@foreach ($products as $product)
<li class="w-64 shrink-0 snap-start">
<x-ui.product-card :product="$product" :currency="$currency" class="transition-shadow hover:shadow-md" />
</li>
@endforeach
</ul>
</x-ui.container>
</x-ui.section>
Installation
php artisan ui:add blocks/product-listing-carousel
Registry contract
Install confidence
php artisan ui:add blocks/product-listing-carousel
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.1.2
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/product-listing-carousel.blade.php |
Registry dependencies
Package dependencies
composer: jml/brok:^0.2
Use with AI
A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.
# Brok UI block: Product Listing Carousel (`product-listing-carousel`)
An e-commerce product listing as a horizontal snap-scroll carousel of product cards with prev/next controls, sale badges, ratings and add-to-cart.
Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.
## Install
```bash
php artisan ui:add blocks/product-listing-carousel
```
## Render it
```blade
<x-blocks.product-listing-carousel />
```
## Props
- `heading` (string, default `Trending now`) — Section heading.
- `view-all-href` (string, default `#`) — Destination for the "View all" link.
- `products` (mixed|null, default `null`) — Array of product entries rendered in the scroll track.
- `currency` (string, default `USD`) — ISO currency code used to format product prices.
## Use when
- Rendering a horizontal, CSS scroll-snap row of product cards under a heading and a "View all" link, for a compact "trending" or featured-products rail.
- Wanting prev/next affordance buttons alongside the heading, understanding they are decorative and rely on the browser's native scrollbar/touch scrolling rather than JS-driven scrolling.
## Avoid when
- Needing a full grid layout with a sort toolbar and result count; use product-listing-grid instead.
## Rules
- Render the installed block with `<x-blocks.product-listing-carousel />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.
## Links
- Docs: https://brokui.dev/blocks/product-listing-carousel
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/product-listing-carousel.json
Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.
Guidance
Use when
- Rendering a horizontal, CSS scroll-snap row of product cards under a heading and a "View all" link, for a compact "trending" or featured-products rail.
- Wanting prev/next affordance buttons alongside the heading, understanding they are decorative and rely on the browser's native scrollbar/touch scrolling rather than JS-driven scrolling.
Avoid when
- Needing a full grid layout with a sort toolbar and result count; use product-listing-grid instead.
Anti-patterns
- Do not replace semantic props with conflicting utility classes.
- Do not remove labels, focus styles, or state attributes.
- Anatomy
Usage
Render the block as a component, passing data where useful:
<x-blocks.product-listing-carousel />
Built from primitives
This block composes installed <brok:*> primitives and semantic design
tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by
editing CSS variables; flip the preview to RTL to confirm it mirrors.
Source
The exact, editable file ui:add writes
into your app. The preview above renders this same source — there are no preview-only blocks.
@props([
'heading' => 'Trending now',
'viewAllHref' => '#',
'products' => null,
'currency' => 'USD',
])
@php
$products ??= [
['name' => 'Aero Knit Runner', 'category' => 'Footwear', 'price' => '118', 'compareAt' => '148', 'rating' => 5, 'reviews' => 214, 'sale' => 'Save 20%', 'gradient' => 'from-primary/20 via-muted to-muted'],
['name' => 'Merino Travel Crew', 'category' => 'Knitwear', 'price' => '96', 'compareAt' => null, 'rating' => 5, 'reviews' => 88, 'sale' => null, 'gradient' => 'from-secondary/30 via-muted to-muted'],
['name' => 'Cascade Shell', 'category' => 'Outerwear', 'price' => '214', 'compareAt' => '260', 'rating' => 4, 'reviews' => 132, 'sale' => 'Save $46', 'gradient' => 'from-accent/40 via-muted to-muted'],
['name' => 'Field Canvas Tote', 'category' => 'Accessories', 'price' => '72', 'compareAt' => null, 'rating' => 4, 'reviews' => 47, 'sale' => 'New', 'gradient' => 'from-primary/10 via-card to-card'],
['name' => 'Studio Linen Shirt', 'category' => 'Shirts', 'price' => '84', 'compareAt' => '110', 'rating' => 4, 'reviews' => 309, 'sale' => 'Sale', 'gradient' => 'from-muted via-muted/60 to-muted'],
['name' => 'Trail Insulated Bottle', 'category' => 'Gear', 'price' => '38', 'compareAt' => null, 'rating' => 5, 'reviews' => 521, 'sale' => null, 'gradient' => 'from-secondary/20 via-card to-card'],
];
@endphp
<x-ui.section space="lg" {{ $attributes }}>
<x-ui.container size="xl" gutter="sm">
<div class="flex items-center justify-between gap-4">
<h2 class="text-2xl font-bold tracking-tight sm:text-3xl">{{ __($heading) }}</h2>
<div class="flex shrink-0 items-center gap-2">
<a href="{{ $viewAllHref }}" class="hidden text-sm font-medium text-link underline-offset-4 hover:underline sm:inline-flex">{{ __('View all') }}</a>
<x-ui.button variant="outline" size="icon" type="button" aria-label="{{ __('Scroll left') }}">
<svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 18l-6-6 6-6" /></svg>
</x-ui.button>
<x-ui.button variant="outline" size="icon" type="button" aria-label="{{ __('Scroll right') }}">
<svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 18l6-6-6-6" /></svg>
</x-ui.button>
</div>
</div>
<ul role="list" class="mt-6 flex snap-x snap-mandatory gap-4 overflow-x-auto scroll-px-4 pb-4">
@foreach ($products as $product)
<li class="w-64 shrink-0 snap-start">
<x-ui.product-card :product="$product" :currency="$currency" class="transition-shadow hover:shadow-md" />
</li>
@endforeach
</ul>
</x-ui.container>
</x-ui.section>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.1.2 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0