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-compact.blade.php Blade
@props([
    'title'       => 'Running Shoes',
    'count'       => 84,
    'sortLabel'   => 'Featured',
    'activeCount' => 0,
])

<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    <div class="mx-auto max-w-7xl px-4 py-4">
        <div class="flex items-center justify-between gap-4">
            <div class="flex min-w-0 items-center gap-2">
                <h1 class="truncate text-lg font-semibold text-foreground">{{ __($title) }}</h1>
                <x-ui.badge variant="secondary" size="sm">{{ number_format($count) }}</x-ui.badge>
            </div>

            <div class="flex shrink-0 items-center gap-2" role="group" aria-label="{{ __('Product list controls') }}">
                <x-ui.button variant="outline" size="sm" type="button" aria-label="{{ __('Open filter panel') }}" aria-pressed="{{ $activeCount > 0 ? 'true' : 'false' }}">
                    <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 ($activeCount > 0)<x-ui.badge variant="default" size="sm" class="ms-2">{{ $activeCount }}</x-ui.badge>@endif
                </x-ui.button>
                <span class="h-4 w-px bg-border" aria-hidden="true"></span>
                <x-ui.button variant="ghost" size="sm" type="button" aria-haspopup="listbox" aria-label="{{ __('Change sort order') }}">
                    {{ __('Sort:') }} <span class="ms-2 font-medium text-foreground">{{ __($sortLabel) }}</span>
                    <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>
        </div>
    </div>
</header>

Installation

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

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/product-header-compact 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-compact.blade.php

Registry dependencies

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-compact.md
# Brok UI block: Product Header Compact (`product-header-compact`)

A compact single-row product-list header with a category title and result-count badge beside filter and sort controls.

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-compact
```

## Render it

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

## Props

- `title` (string, default `Running Shoes`) — Category title.
- `count` (int, default `84`) — Result count shown as a badge beside the title.
- `sort-label` (string, default `Featured`) — Label for the currently applied sort order.
- `active-count` (int, default `0`) — Number of active filters shown as a badge on the filter button; 0 hides the badge.

## Use when

- Heading a product list with a compact single row: a category title, a result-count badge, and filter and sort buttons, without a breadcrumb or description.
- Wanting an active-filter count badge on the filter button itself rather than a row of removable chips.

## Avoid when

- Needing a breadcrumb, description or a grid/list view toggle in the header; use product-header-listing instead.

## Rules

- Render the installed block with `<x-blocks.product-header-compact />` 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-compact
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/product-header-compact.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 list with a compact single row: a category title, a result-count badge, and filter and sort buttons, without a breadcrumb or description.
  • Wanting an active-filter count badge on the filter button itself rather than a row of removable chips.

Avoid when

  • Needing a breadcrumb, description or a grid/list view toggle in the header; use product-header-listing instead.

Anti-patterns

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

Usage

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

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

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-compact.blade.php Blade
@props([
    'title'       => 'Running Shoes',
    'count'       => 84,
    'sortLabel'   => 'Featured',
    'activeCount' => 0,
])

<header {{ $attributes->merge(['class' => 'border-b border-border bg-background']) }}>
    <div class="mx-auto max-w-7xl px-4 py-4">
        <div class="flex items-center justify-between gap-4">
            <div class="flex min-w-0 items-center gap-2">
                <h1 class="truncate text-lg font-semibold text-foreground">{{ __($title) }}</h1>
                <x-ui.badge variant="secondary" size="sm">{{ number_format($count) }}</x-ui.badge>
            </div>

            <div class="flex shrink-0 items-center gap-2" role="group" aria-label="{{ __('Product list controls') }}">
                <x-ui.button variant="outline" size="sm" type="button" aria-label="{{ __('Open filter panel') }}" aria-pressed="{{ $activeCount > 0 ? 'true' : 'false' }}">
                    <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 ($activeCount > 0)<x-ui.badge variant="default" size="sm" class="ms-2">{{ $activeCount }}</x-ui.badge>@endif
                </x-ui.button>
                <span class="h-4 w-px bg-border" aria-hidden="true"></span>
                <x-ui.button variant="ghost" size="sm" type="button" aria-haspopup="listbox" aria-label="{{ __('Change sort order') }}">
                    {{ __('Sort:') }} <span class="ms-2 font-medium text-foreground">{{ __($sortLabel) }}</span>
                    <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>
        </div>
    </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