Product Category
Category pages — a banner with a faceted filter sidebar (categories, price, swatches) and a product grid.
Preview
@props([
'heading' => 'Shop by category',
'subheading' => 'Discover our curated collections, crafted for every style and season.',
'categories' => null,
])
@php
$categories ??= [
[
'name' => 'Outerwear',
'count' => 84,
'hero' => true,
],
[
'name' => 'Footwear',
'count' => 112,
'hero' => false,
],
[
'name' => 'Knitwear',
'count' => 56,
'hero' => false,
],
[
'name' => 'Accessories',
'count' => 203,
'hero' => false,
],
[
'name' => 'Shirts',
'count' => 97,
'hero' => false,
],
];
@endphp
<x-ui.section
aria-label="{{ __('Shop by category') }}"
data-slot="product-category-01"
space="lg" {{ $attributes }}
>
<x-ui.container gutter="sm">
{{-- Heading --}}
<div class="mx-auto mb-10 max-w-2xl text-center">
<h2 class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
@if ($subheading)
<p class="mt-4 text-pretty text-base text-muted-foreground">{{ __($subheading) }}</p>
@endif
</div>
{{-- Mosaic grid --}}
<ul
role="list"
class="grid grid-cols-2 gap-4 lg:grid-cols-4 lg:grid-rows-2 sm:gap-4"
>
@foreach ($categories as $index => $category)
@php $isHero = !empty($category['hero']); @endphp
<li
class="group relative overflow-hidden rounded-lg bg-muted @if ($isHero) col-span-2 row-span-2 min-h-[360px] @else min-h-[160px] @endif"
>
{{-- Placeholder artwork --}}
<div class="absolute inset-0 transition-transform duration-500 ease-out group-hover:scale-105" aria-hidden="true">
<svg
class="size-full text-muted-foreground/15"
viewBox="0 0 400 400"
fill="none"
stroke="currentColor"
stroke-width="1"
preserveAspectRatio="xMidYMid slice"
>
@if ($isHero)
{{-- Hero: flowing diagonal lines for visual weight --}}
<line x1="-40" y1="0" x2="440" y2="400" />
<line x1="-40" y1="80" x2="440" y2="480" />
<line x1="-40" y1="160" x2="440" y2="560" />
<line x1="-40" y1="240" x2="440" y2="640" />
<line x1="-40" y1="-80" x2="440" y2="320" />
<circle cx="200" cy="180" r="60" stroke-width="0.8" />
<circle cx="200" cy="180" r="100" stroke-width="0.5" />
@else
{{-- Smaller tiles: subtle grid dots --}}
@foreach (range(0, 3) as $row)
@foreach (range(0, 5) as $col)
<circle cx="{{ 40 + $col * 70 }}" cy="{{ 60 + $row * 100 }}" r="2" fill="currentColor" stroke="none" />
@endforeach
@endforeach
@endif
</svg>
</div>
{{-- Gradient overlay --}}
<div class="absolute inset-0 bg-gradient-to-t from-background/80 via-background/20 to-transparent" aria-hidden="true"></div>
{{-- Content --}}
<div class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-4 p-4 @if ($isHero) p-6 @endif">
<div class="min-w-0">
<h3 class="font-semibold text-foreground @if ($isHero) text-2xl @else text-base @endif truncate">
{{ __($category['name']) }}
</h3>
<p class="mt-0.5 text-base text-muted-foreground">
{{ trans_choice(':count item|:count items', $category['count'], ['count' => $category['count']]) }}
</p>
</div>
<div class="shrink-0">
<x-ui.badge variant="secondary">
{{ $category['count'] }}
</x-ui.badge>
</div>
</div>
{{-- Full-tile accessible link --}}
<a
href="#"
class="absolute inset-0 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
aria-label="{{ __('Shop :category', ['category' => $category['name']]) }}"
>
<span class="sr-only">{{ __('Shop :category', ['category' => $category['name']]) }}</span>
</a>
</li>
@endforeach
</ul>
{{-- Browse all CTA --}}
<div class="mt-8 text-center">
<x-ui.button variant="outline" :withArrow="true" href="#">
{{ __('Browse all categories') }}
</x-ui.button>
</div>
</x-ui.container>
</x-ui.section>
Installation
php artisan ui:add blocks/product-category-mosaic
Registry contract
Install confidence
php artisan ui:add blocks/product-category-mosaic
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.0.4
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/product-category-mosaic.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 Category Mosaic (`product-category-mosaic`)
Editorial category mosaic with an asymmetric CSS grid, a dominant hero tile, gradient overlays, hover-scale thumbnails, and item-count badges.
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-category-mosaic
```
## Render it
```blade
<x-blocks.product-category-mosaic />
```
## Props
- `heading` (string, default `Shop by category`) — Section heading.
- `subheading` (string, default `Discover our curated collections, crafted for every style and season.`) — Supporting copy under the heading.
- `categories` (mixed|null, default `null`) — Array of {name, count, hero} category entries; the first hero entry spans a larger mosaic tile.
## Use when
- Opening a storefront with an editorial, image-forward shop-by-category mosaic that uses an asymmetric CSS grid, a dominant hero tile and gradient overlays with hover-scale thumbnails.
- Wanting item-count badges on each category tile as a purely visual entry point, with no products or filters rendered.
## Avoid when
- Needing a calm, equal-column editorial category grid instead of an asymmetric hero mosaic; use product-category-editorial.
## Rules
- Render the installed block with `<x-blocks.product-category-mosaic />` 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-category-mosaic
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/product-category-mosaic.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
- Opening a storefront with an editorial, image-forward shop-by-category mosaic that uses an asymmetric CSS grid, a dominant hero tile and gradient overlays with hover-scale thumbnails.
- Wanting item-count badges on each category tile as a purely visual entry point, with no products or filters rendered.
Avoid when
- Needing a calm, equal-column editorial category grid instead of an asymmetric hero mosaic; use product-category-editorial.
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-category-mosaic />
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' => 'Shop by category',
'subheading' => 'Discover our curated collections, crafted for every style and season.',
'categories' => null,
])
@php
$categories ??= [
[
'name' => 'Outerwear',
'count' => 84,
'hero' => true,
],
[
'name' => 'Footwear',
'count' => 112,
'hero' => false,
],
[
'name' => 'Knitwear',
'count' => 56,
'hero' => false,
],
[
'name' => 'Accessories',
'count' => 203,
'hero' => false,
],
[
'name' => 'Shirts',
'count' => 97,
'hero' => false,
],
];
@endphp
<x-ui.section
aria-label="{{ __('Shop by category') }}"
data-slot="product-category-01"
space="lg" {{ $attributes }}
>
<x-ui.container gutter="sm">
{{-- Heading --}}
<div class="mx-auto mb-10 max-w-2xl text-center">
<h2 class="text-balance text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
@if ($subheading)
<p class="mt-4 text-pretty text-base text-muted-foreground">{{ __($subheading) }}</p>
@endif
</div>
{{-- Mosaic grid --}}
<ul
role="list"
class="grid grid-cols-2 gap-4 lg:grid-cols-4 lg:grid-rows-2 sm:gap-4"
>
@foreach ($categories as $index => $category)
@php $isHero = !empty($category['hero']); @endphp
<li
class="group relative overflow-hidden rounded-lg bg-muted @if ($isHero) col-span-2 row-span-2 min-h-[360px] @else min-h-[160px] @endif"
>
{{-- Placeholder artwork --}}
<div class="absolute inset-0 transition-transform duration-500 ease-out group-hover:scale-105" aria-hidden="true">
<svg
class="size-full text-muted-foreground/15"
viewBox="0 0 400 400"
fill="none"
stroke="currentColor"
stroke-width="1"
preserveAspectRatio="xMidYMid slice"
>
@if ($isHero)
{{-- Hero: flowing diagonal lines for visual weight --}}
<line x1="-40" y1="0" x2="440" y2="400" />
<line x1="-40" y1="80" x2="440" y2="480" />
<line x1="-40" y1="160" x2="440" y2="560" />
<line x1="-40" y1="240" x2="440" y2="640" />
<line x1="-40" y1="-80" x2="440" y2="320" />
<circle cx="200" cy="180" r="60" stroke-width="0.8" />
<circle cx="200" cy="180" r="100" stroke-width="0.5" />
@else
{{-- Smaller tiles: subtle grid dots --}}
@foreach (range(0, 3) as $row)
@foreach (range(0, 5) as $col)
<circle cx="{{ 40 + $col * 70 }}" cy="{{ 60 + $row * 100 }}" r="2" fill="currentColor" stroke="none" />
@endforeach
@endforeach
@endif
</svg>
</div>
{{-- Gradient overlay --}}
<div class="absolute inset-0 bg-gradient-to-t from-background/80 via-background/20 to-transparent" aria-hidden="true"></div>
{{-- Content --}}
<div class="absolute inset-x-0 bottom-0 flex items-end justify-between gap-4 p-4 @if ($isHero) p-6 @endif">
<div class="min-w-0">
<h3 class="font-semibold text-foreground @if ($isHero) text-2xl @else text-base @endif truncate">
{{ __($category['name']) }}
</h3>
<p class="mt-0.5 text-base text-muted-foreground">
{{ trans_choice(':count item|:count items', $category['count'], ['count' => $category['count']]) }}
</p>
</div>
<div class="shrink-0">
<x-ui.badge variant="secondary">
{{ $category['count'] }}
</x-ui.badge>
</div>
</div>
{{-- Full-tile accessible link --}}
<a
href="#"
class="absolute inset-0 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
aria-label="{{ __('Shop :category', ['category' => $category['name']]) }}"
>
<span class="sr-only">{{ __('Shop :category', ['category' => $category['name']]) }}</span>
</a>
</li>
@endforeach
</ul>
{{-- Browse all CTA --}}
<div class="mt-8 text-center">
<x-ui.button variant="outline" :withArrow="true" href="#">
{{ __('Browse all categories') }}
</x-ui.button>
</div>
</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.0.4 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0