Skip to content
Brok UI

Loading…

No results

Product Header

Open source

Product-listing page headers — breadcrumb, category title and result count beside sort, view-mode and filter controls.

Preview

resources/views/blocks/product-header-listing.blade.php Blade
@props([
    'title'         => 'Men\'s Shoes',
    'count'         => 128,
    'description'   => 'Explore our full range of men\'s footwear — from everyday trainers to formal dress shoes, crafted for comfort and style.',
    'breadcrumbs'   => null,
    'activeFilters' => null,
])

@php
    $breadcrumbs ??= [
        ['label' => 'Home', 'href' => '/'],
        ['label' => 'Men', 'href' => '/men'],
        ['label' => 'Shoes', 'href' => null],
    ];

    $activeFilters ??= [
        ['label' => 'Size: 10'],
        ['label' => 'Colour: Black'],
        ['label' => 'Brand: Nimbus'],
    ];

    $lastIndex = count($breadcrumbs) - 1;
@endphp

<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    <div class="mx-auto max-w-7xl px-4 py-6">
        <x-ui.breadcrumb class="mb-4">
            <x-ui.breadcrumb.list>
                @foreach ($breadcrumbs as $index => $crumb)
                    <x-ui.breadcrumb.item>
                        @if ($index === $lastIndex)
                            <x-ui.breadcrumb.page>{{ __($crumb['label']) }}</x-ui.breadcrumb.page>
                        @else
                            <x-ui.breadcrumb.link :href="$crumb['href']">{{ __($crumb['label']) }}</x-ui.breadcrumb.link>
                        @endif
                    </x-ui.breadcrumb.item>
                    @if ($index < $lastIndex)
                        <x-ui.breadcrumb.separator />
                    @endif
                @endforeach
            </x-ui.breadcrumb.list>
        </x-ui.breadcrumb>

        <div class="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
            <div class="flex flex-col gap-2">
                <h1 class="text-2xl font-bold text-foreground sm:text-3xl">{{ __($title) }}</h1>
                <p class="text-sm text-muted-foreground">{{ __(':count products', ['count' => number_format($count)]) }}</p>
                @if ($description)
                    <p class="mt-2 max-w-prose text-sm text-muted-foreground">{{ __($description) }}</p>
                @endif
            </div>

            <div class="flex flex-wrap items-center gap-2">
                <x-ui.button variant="outline" type="button" aria-label="{{ __('Sort order') }}">
                    {{ __('Sort by: Featured') }}
                    <svg class="ms-2 size-4 shrink-0 text-muted-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="m6 9 6 6 6-6" />
                    </svg>
                </x-ui.button>

                <div class="inline-flex rounded-md border border-border" role="group" aria-label="{{ __('View mode') }}">
                    <x-ui.button variant="ghost" size="icon" type="button" aria-label="{{ __('Grid view') }}" aria-pressed="true" class="rounded-e-none border-e border-border">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <rect x="3" y="3" width="7" height="7" rx="1" /><rect x="14" y="3" width="7" height="7" rx="1" /><rect x="3" y="14" width="7" height="7" rx="1" /><rect x="14" y="14" width="7" height="7" rx="1" />
                        </svg>
                    </x-ui.button>
                    <x-ui.button variant="ghost" size="icon" type="button" aria-label="{{ __('List view') }}" aria-pressed="false" class="rounded-s-none">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" /><line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" />
                        </svg>
                    </x-ui.button>
                </div>

                <x-ui.button variant="outline" type="button" aria-label="{{ __('Open filters') }}">
                    <x-slot:icon>
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <path d="M3 4h18M7 10h10M11 16h2" />
                        </svg>
                    </x-slot:icon>
                    {{ __('Filters') }}
                    @if (! empty($activeFilters))
                        <x-ui.badge variant="secondary" size="sm" class="ms-2">{{ count($activeFilters) }}</x-ui.badge>
                    @endif
                </x-ui.button>
            </div>
        </div>

        @if (! empty($activeFilters))
            <div class="mt-4 flex flex-wrap items-center gap-2" aria-label="{{ __('Active filters') }}">
                @foreach ($activeFilters as $filter)
                    <x-ui.badge variant="outline" class="gap-2 pe-2 text-foreground">
                        <span>{{ __($filter['label']) }}</span>
                        <button type="button" aria-label="{{ __('Remove filter') }}: {{ __($filter['label']) }}" class="ms-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
                            <svg class="size-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                <line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
                            </svg>
                        </button>
                    </x-ui.badge>
                @endforeach
                <button type="button" class="text-sm text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">{{ __('Clear all') }}</button>
            </div>
        @endif
    </div>
</header>

Installation

terminal
php artisan ui:add blocks/product-header-listing

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/product-header-listing 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.3
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/product-header-listing.blade.php

Registry dependencies

breadcrumb button badge

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.

product-header-listing.md
# Brok UI block: Product Header (`product-header-listing`)

A product-listing page header with a breadcrumb, category title, result count and description beside sort, grid and list view, and filter controls with active-filter chips.

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-header-listing
```

## Render it

```blade
<x-blocks.product-header-listing />
```

## Props

- `title` (string, default `Men\'s Shoes`) — Category title.
- `count` (int, default `128`) — Result count shown under the title.
- `description` (string, default `Explore our full range of men\'s footwear — from everyday trainers to formal dress shoes, crafted for comfort and style.`) — Supporting copy under the title and count.
- `breadcrumbs` (mixed|null, default `null`) — Array of {label, href} breadcrumb entries.
- `active-filters` (mixed|null, default `null`) — Array of {label} active-filter chip entries shown beneath the header.

## Use when

- Heading a product-listing page with a breadcrumb, category title, result count and description alongside sort, grid/list view and filter controls.
- Showing active-filter chips beneath the header row so the current filter state stays visible.

## Avoid when

- Needing a compact single-row header without a breadcrumb or description; use product-header-compact instead.

## Rules

- Render the installed block with `<x-blocks.product-header-listing />` 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-header-listing
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/product-header-listing.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

  • Heading a product-listing page with a breadcrumb, category title, result count and description alongside sort, grid/list view and filter controls.
  • Showing active-filter chips beneath the header row so the current filter state stays visible.

Avoid when

  • Needing a compact single-row header without a breadcrumb or description; use product-header-compact instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
header breadcrumb title result count description sort button view toggle filter button active filter chips

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.product-header-listing />

Built from primitives

Composes <brok:*> Semantic tokens Re-themeable RTL-ready

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.

resources/views/blocks/product-header-listing.blade.php Blade
@props([
    'title'         => 'Men\'s Shoes',
    'count'         => 128,
    'description'   => 'Explore our full range of men\'s footwear — from everyday trainers to formal dress shoes, crafted for comfort and style.',
    'breadcrumbs'   => null,
    'activeFilters' => null,
])

@php
    $breadcrumbs ??= [
        ['label' => 'Home', 'href' => '/'],
        ['label' => 'Men', 'href' => '/men'],
        ['label' => 'Shoes', 'href' => null],
    ];

    $activeFilters ??= [
        ['label' => 'Size: 10'],
        ['label' => 'Colour: Black'],
        ['label' => 'Brand: Nimbus'],
    ];

    $lastIndex = count($breadcrumbs) - 1;
@endphp

<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    <div class="mx-auto max-w-7xl px-4 py-6">
        <x-ui.breadcrumb class="mb-4">
            <x-ui.breadcrumb.list>
                @foreach ($breadcrumbs as $index => $crumb)
                    <x-ui.breadcrumb.item>
                        @if ($index === $lastIndex)
                            <x-ui.breadcrumb.page>{{ __($crumb['label']) }}</x-ui.breadcrumb.page>
                        @else
                            <x-ui.breadcrumb.link :href="$crumb['href']">{{ __($crumb['label']) }}</x-ui.breadcrumb.link>
                        @endif
                    </x-ui.breadcrumb.item>
                    @if ($index < $lastIndex)
                        <x-ui.breadcrumb.separator />
                    @endif
                @endforeach
            </x-ui.breadcrumb.list>
        </x-ui.breadcrumb>

        <div class="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
            <div class="flex flex-col gap-2">
                <h1 class="text-2xl font-bold text-foreground sm:text-3xl">{{ __($title) }}</h1>
                <p class="text-sm text-muted-foreground">{{ __(':count products', ['count' => number_format($count)]) }}</p>
                @if ($description)
                    <p class="mt-2 max-w-prose text-sm text-muted-foreground">{{ __($description) }}</p>
                @endif
            </div>

            <div class="flex flex-wrap items-center gap-2">
                <x-ui.button variant="outline" type="button" aria-label="{{ __('Sort order') }}">
                    {{ __('Sort by: Featured') }}
                    <svg class="ms-2 size-4 shrink-0 text-muted-foreground" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                        <path d="m6 9 6 6 6-6" />
                    </svg>
                </x-ui.button>

                <div class="inline-flex rounded-md border border-border" role="group" aria-label="{{ __('View mode') }}">
                    <x-ui.button variant="ghost" size="icon" type="button" aria-label="{{ __('Grid view') }}" aria-pressed="true" class="rounded-e-none border-e border-border">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <rect x="3" y="3" width="7" height="7" rx="1" /><rect x="14" y="3" width="7" height="7" rx="1" /><rect x="3" y="14" width="7" height="7" rx="1" /><rect x="14" y="14" width="7" height="7" rx="1" />
                        </svg>
                    </x-ui.button>
                    <x-ui.button variant="ghost" size="icon" type="button" aria-label="{{ __('List view') }}" aria-pressed="false" class="rounded-s-none">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" /><line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" />
                        </svg>
                    </x-ui.button>
                </div>

                <x-ui.button variant="outline" type="button" aria-label="{{ __('Open filters') }}">
                    <x-slot:icon>
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                            <path d="M3 4h18M7 10h10M11 16h2" />
                        </svg>
                    </x-slot:icon>
                    {{ __('Filters') }}
                    @if (! empty($activeFilters))
                        <x-ui.badge variant="secondary" size="sm" class="ms-2">{{ count($activeFilters) }}</x-ui.badge>
                    @endif
                </x-ui.button>
            </div>
        </div>

        @if (! empty($activeFilters))
            <div class="mt-4 flex flex-wrap items-center gap-2" aria-label="{{ __('Active filters') }}">
                @foreach ($activeFilters as $filter)
                    <x-ui.badge variant="outline" class="gap-2 pe-2 text-foreground">
                        <span>{{ __($filter['label']) }}</span>
                        <button type="button" aria-label="{{ __('Remove filter') }}: {{ __($filter['label']) }}" class="ms-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
                            <svg class="size-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                                <line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
                            </svg>
                        </button>
                    </x-ui.badge>
                @endforeach
                <button type="button" class="text-sm text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">{{ __('Clear all') }}</button>
            </div>
        @endif
    </div>
</header>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.0.3
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0