Skip to content
Brok UI

Loading…

No results

Gallery

Open source

Image galleries — a masonry wall and a uniform grid with a lightbox.

Preview

4 of 6

resources/views/blocks/gallery-filtered.blade.php Blade
@props([
    'eyebrow'    => 'Our work',
    'heading'    => 'Browse the collection',
    'subheading' => 'Filter by category to explore every corner of the portfolio.',
    'categories' => null,
    'items'      => null,
])

@php
    $categories ??= ['All', 'Branding', 'Photography', 'Architecture', 'Product'];

    $items ??= [
        ['title' => 'Meridian identity system', 'category' => 'Branding', 'tone' => 'from-primary/20 via-muted to-background'],
        ['title' => 'Golden-hour rooftop', 'category' => 'Photography', 'tone' => 'from-secondary/35 via-muted to-background'],
        ['title' => 'Glass atrium study', 'category' => 'Architecture', 'tone' => 'from-primary/30 via-secondary/20 to-background'],
        ['title' => 'Minimal carry case', 'category' => 'Product', 'tone' => 'from-muted via-background to-primary/25'],
        ['title' => 'Volta wordmark', 'category' => 'Branding', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Stairwell geometry', 'category' => 'Architecture', 'tone' => 'from-primary/15 via-muted to-secondary/30'],
        ['title' => 'Morning mist portrait', 'category' => 'Photography', 'tone' => 'from-muted via-primary/15 to-background'],
        ['title' => 'Ember candle set', 'category' => 'Product', 'tone' => 'from-secondary/25 via-background to-primary/20'],
        ['title' => 'Bloom brand palette', 'category' => 'Branding', 'tone' => 'from-primary/25 via-secondary/25 to-background'],
    ];
@endphp

<x-ui.section
    x-data="{ filter: 'All' }"
    space="xl" {{ $attributes }}
>
    <x-ui.container gutter="sm">
        <x-ui.section-heading align="center" overline-style="badge" :overline="$eyebrow" :title="$heading" :subtitle="$subheading" />

        <x-ui.segmented-nav as="div" label="{{ __('Gallery categories') }}" class="mt-10 flex-wrap justify-center">
            @foreach ($categories as $category)
                <x-ui.segmented-nav.item
                    x-active="filter === {{ Js::from($category) }}"
                    x-on:click="filter = {{ Js::from($category) }}"
                    aria-label="{{ __('Filter by :category', ['category' => __($category)]) }}"
                >{{ __($category) }}</x-ui.segmented-nav.item>
            @endforeach
        </x-ui.segmented-nav>

        <ul role="list" class="mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
            @foreach ($items as $item)
                <li
                    x-show="filter === 'All' || filter === {{ Js::from($item['category']) }}"
                    x-transition:enter="transition duration-200 ease-out"
                    x-transition:enter-start="opacity-0 scale-95"
                    x-transition:enter-end="opacity-100 scale-100"
                    x-transition:leave="transition duration-150 ease-in"
                    x-transition:leave-start="opacity-100 scale-100"
                    x-transition:leave-end="opacity-0 scale-95"
                >
                    <figure data-slot="gallery-item" class="group relative aspect-[4/3] overflow-hidden rounded-lg bg-muted">
                        <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}" role="img" aria-label="{{ __($item['title']) }}"></div>
                        <figcaption class="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-foreground/0 p-4 text-center opacity-0 transition-colors duration-300 group-hover:bg-foreground/40 group-hover:opacity-100">
                            <span class="text-balance text-base font-semibold text-background drop-shadow">{{ __($item['title']) }}</span>
                            <x-ui.badge variant="secondary">{{ __($item['category']) }}</x-ui.badge>
                        </figcaption>
                        <span class="absolute bottom-2 start-2 inline-flex size-7 items-center justify-center rounded-md bg-background/70 text-foreground backdrop-blur transition-opacity duration-300 group-hover:opacity-0" aria-hidden="true">
                            <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="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" /><circle cx="12" cy="13" r="4" />
                            </svg>
                        </span>
                    </figure>
                </li>
            @endforeach
        </ul>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/gallery-filtered

Registry contract

Install confidence

php artisan ui:add blocks/gallery-filtered 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/gallery-filtered.blade.php

Registry dependencies

badge container section section-heading segmented-nav

Package dependencies

composer: jml/brok:^0.2

npm: alpinejs

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.

gallery-filtered.md
# Brok UI block: Gallery Filter (`gallery-filtered`)

An image gallery with a category filter pill bar above a responsive grid of tiles that reveal a title and category badge on hover.

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/gallery-filtered
```

## Render it

```blade
<x-blocks.gallery-filtered />
```

## Props

- `eyebrow` (string, default `Our work`) — Small badge label shown above the heading.
- `heading` (string, default `Browse the collection`) — Main section heading text.
- `subheading` (string, default `Filter by category to explore every corner of the portfolio.`) — Supporting subheading text below the heading.
- `categories` (mixed|null, default `null`) — Array of category labels shown as filter segments; defaults to All, Branding, Photography, Architecture, Product.
- `items` (mixed|null, default `null`) — Array of gallery items ({title, category, tone}); defaults to a built-in set of nine sample tiles.

## Use when

- Letting visitors filter a portfolio grid by category using a segmented control.
- Showing a responsive image grid where each tile reveals its title and category badge on hover.

## Avoid when

- Use gallery-masonry instead when the gallery has no categories to filter.

## Rules

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

  • Letting visitors filter a portfolio grid by category using a segmented control.
  • Showing a responsive image grid where each tile reveals its title and category badge on hover.

Avoid when

  • Use gallery-masonry instead when the gallery has no categories to filter.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
eyebrow badge heading category filter bar gallery grid gallery item

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.gallery-filtered />

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/gallery-filtered.blade.php Blade
@props([
    'eyebrow'    => 'Our work',
    'heading'    => 'Browse the collection',
    'subheading' => 'Filter by category to explore every corner of the portfolio.',
    'categories' => null,
    'items'      => null,
])

@php
    $categories ??= ['All', 'Branding', 'Photography', 'Architecture', 'Product'];

    $items ??= [
        ['title' => 'Meridian identity system', 'category' => 'Branding', 'tone' => 'from-primary/20 via-muted to-background'],
        ['title' => 'Golden-hour rooftop', 'category' => 'Photography', 'tone' => 'from-secondary/35 via-muted to-background'],
        ['title' => 'Glass atrium study', 'category' => 'Architecture', 'tone' => 'from-primary/30 via-secondary/20 to-background'],
        ['title' => 'Minimal carry case', 'category' => 'Product', 'tone' => 'from-muted via-background to-primary/25'],
        ['title' => 'Volta wordmark', 'category' => 'Branding', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Stairwell geometry', 'category' => 'Architecture', 'tone' => 'from-primary/15 via-muted to-secondary/30'],
        ['title' => 'Morning mist portrait', 'category' => 'Photography', 'tone' => 'from-muted via-primary/15 to-background'],
        ['title' => 'Ember candle set', 'category' => 'Product', 'tone' => 'from-secondary/25 via-background to-primary/20'],
        ['title' => 'Bloom brand palette', 'category' => 'Branding', 'tone' => 'from-primary/25 via-secondary/25 to-background'],
    ];
@endphp

<x-ui.section
    x-data="{ filter: 'All' }"
    space="xl" {{ $attributes }}
>
    <x-ui.container gutter="sm">
        <x-ui.section-heading align="center" overline-style="badge" :overline="$eyebrow" :title="$heading" :subtitle="$subheading" />

        <x-ui.segmented-nav as="div" label="{{ __('Gallery categories') }}" class="mt-10 flex-wrap justify-center">
            @foreach ($categories as $category)
                <x-ui.segmented-nav.item
                    x-active="filter === {{ Js::from($category) }}"
                    x-on:click="filter = {{ Js::from($category) }}"
                    aria-label="{{ __('Filter by :category', ['category' => __($category)]) }}"
                >{{ __($category) }}</x-ui.segmented-nav.item>
            @endforeach
        </x-ui.segmented-nav>

        <ul role="list" class="mt-10 grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
            @foreach ($items as $item)
                <li
                    x-show="filter === 'All' || filter === {{ Js::from($item['category']) }}"
                    x-transition:enter="transition duration-200 ease-out"
                    x-transition:enter-start="opacity-0 scale-95"
                    x-transition:enter-end="opacity-100 scale-100"
                    x-transition:leave="transition duration-150 ease-in"
                    x-transition:leave-start="opacity-100 scale-100"
                    x-transition:leave-end="opacity-0 scale-95"
                >
                    <figure data-slot="gallery-item" class="group relative aspect-[4/3] overflow-hidden rounded-lg bg-muted">
                        <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}" role="img" aria-label="{{ __($item['title']) }}"></div>
                        <figcaption class="absolute inset-0 flex flex-col items-center justify-center gap-2 bg-foreground/0 p-4 text-center opacity-0 transition-colors duration-300 group-hover:bg-foreground/40 group-hover:opacity-100">
                            <span class="text-balance text-base font-semibold text-background drop-shadow">{{ __($item['title']) }}</span>
                            <x-ui.badge variant="secondary">{{ __($item['category']) }}</x-ui.badge>
                        </figcaption>
                        <span class="absolute bottom-2 start-2 inline-flex size-7 items-center justify-center rounded-md bg-background/70 text-foreground backdrop-blur transition-opacity duration-300 group-hover:opacity-0" aria-hidden="true">
                            <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="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" /><circle cx="12" cy="13" r="4" />
                            </svg>
                        </span>
                    </figure>
                </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