Skip to content
Brok UI

Loading…

No results

Gallery

Open source

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

Preview

2 of 6

resources/views/blocks/gallery-grid.blade.php Blade
@props([
    'eyebrow' => 'Gallery',
    'heading' => 'Moments from the studio',
    'subheading' => 'A curated look at the work, the process, and the people behind it.',
    'items' => null,
])

@php
    $items ??= [
        ['title' => 'Atrium light study', 'category' => 'Architecture', 'tone' => 'from-primary/25 via-muted to-background'],
        ['title' => 'Workshop in progress', 'category' => 'Process', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Material samples', 'category' => 'Detail', 'tone' => 'from-muted via-background to-primary/20'],
        ['title' => 'Evening skyline', 'category' => 'Landscape', 'tone' => 'from-primary/30 via-secondary/30 to-background'],
        ['title' => 'Quiet corner', 'category' => 'Interior', 'tone' => 'from-muted via-primary/15 to-background'],
        ['title' => 'On location', 'category' => 'Field', 'tone' => 'from-secondary/30 via-muted to-background'],
        ['title' => 'Prototype review', 'category' => 'Process', 'tone' => 'from-primary/20 via-background to-secondary/25'],
        ['title' => 'Final assembly', 'category' => 'Detail', 'tone' => 'from-muted via-background to-primary/25'],
    ];
@endphp

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

        <ul role="list" class="mt-12 grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4">
            @foreach ($items as $i => $item)
                <li>
                    <x-ui.dialog>
                        <x-ui.dialog.trigger
                            class="group relative block w-full rounded-lg border border-border bg-card text-start shadow-sm transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background hover:shadow-md"
                            :aria-label="__('Open :title in lightbox', ['title' => __($item['title'])])"
                        >
                            <x-ui.aspect-ratio ratio="1" class="rounded-lg">
                                <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}"></div>

                                {{-- Hover overlay: caption + expand affordance --}}
                                <div class="absolute inset-0 flex flex-col justify-end bg-gradient-to-t from-foreground/70 via-foreground/0 to-foreground/0 p-4 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100">
                                    <p class="text-sm font-medium text-background">{{ __($item['category']) }}</p>
                                    <p class="text-sm font-semibold text-background line-clamp-1">{{ __($item['title']) }}</p>
                                </div>

                                <span class="absolute end-2 top-2 inline-flex size-7 items-center justify-center rounded-md bg-background/80 text-foreground opacity-0 backdrop-blur transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100">
                                    <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="M15 3h6v6" />
                                        <path d="M9 21H3v-6" />
                                        <path d="M21 3l-7 7" />
                                        <path d="M3 21l7-7" />
                                    </svg>
                                </span>
                            </x-ui.aspect-ratio>
                        </x-ui.dialog.trigger>

                        <x-ui.dialog.content class="max-w-3xl">
                            <figure>
                                <x-ui.aspect-ratio ratio="16 / 10" class="rounded-lg border border-border">
                                    <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}"></div>
                                </x-ui.aspect-ratio>
                                <figcaption class="mt-4">
                                    <x-ui.dialog.title>{{ __($item['title']) }}</x-ui.dialog.title>
                                    <x-ui.dialog.description class="mt-2">{{ __($item['category']) }}</x-ui.dialog.description>
                                </figcaption>
                            </figure>
                        </x-ui.dialog.content>
                    </x-ui.dialog>
                </li>
            @endforeach
        </ul>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/gallery-grid

Registry contract

Install confidence

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

Registry dependencies

aspect-ratio badge container dialog section section-heading

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.

gallery-grid.md
# Brok UI block: Gallery Grid (`gallery-grid`)

A uniform square-grid gallery of token-gradient image tiles with hover captions that open an enlarged lightbox dialog.

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

## Render it

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

## Props

- `eyebrow` (string, default `Gallery`) — Small badge label shown above the heading.
- `heading` (string, default `Moments from the studio`) — Main section heading text.
- `subheading` (string, default `A curated look at the work, the process, and the people behind it.`) — Supporting subheading text below the heading.
- `items` (mixed|null, default `null`) — Array of gallery items ({title, category, tone}); defaults to a built-in set of eight sample tiles.

## Use when

- Displaying a uniform square grid of images that each open an enlarged lightbox on click.
- Presenting a compact portfolio grid where hovering reveals a title and category before opening detail.

## Avoid when

- Use gallery-masonry instead for a masonry layout without a lightbox, or gallery-justified for a justified-row lightbox gallery.

## Rules

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

  • Displaying a uniform square grid of images that each open an enlarged lightbox on click.
  • Presenting a compact portfolio grid where hovering reveals a title and category before opening detail.

Avoid when

  • Use gallery-masonry instead for a masonry layout without a lightbox, or gallery-justified for a justified-row lightbox gallery.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
eyebrow badge heading image grid grid tile trigger lightbox dialog

Usage

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

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

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-grid.blade.php Blade
@props([
    'eyebrow' => 'Gallery',
    'heading' => 'Moments from the studio',
    'subheading' => 'A curated look at the work, the process, and the people behind it.',
    'items' => null,
])

@php
    $items ??= [
        ['title' => 'Atrium light study', 'category' => 'Architecture', 'tone' => 'from-primary/25 via-muted to-background'],
        ['title' => 'Workshop in progress', 'category' => 'Process', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Material samples', 'category' => 'Detail', 'tone' => 'from-muted via-background to-primary/20'],
        ['title' => 'Evening skyline', 'category' => 'Landscape', 'tone' => 'from-primary/30 via-secondary/30 to-background'],
        ['title' => 'Quiet corner', 'category' => 'Interior', 'tone' => 'from-muted via-primary/15 to-background'],
        ['title' => 'On location', 'category' => 'Field', 'tone' => 'from-secondary/30 via-muted to-background'],
        ['title' => 'Prototype review', 'category' => 'Process', 'tone' => 'from-primary/20 via-background to-secondary/25'],
        ['title' => 'Final assembly', 'category' => 'Detail', 'tone' => 'from-muted via-background to-primary/25'],
    ];
@endphp

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

        <ul role="list" class="mt-12 grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4">
            @foreach ($items as $i => $item)
                <li>
                    <x-ui.dialog>
                        <x-ui.dialog.trigger
                            class="group relative block w-full rounded-lg border border-border bg-card text-start shadow-sm transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background hover:shadow-md"
                            :aria-label="__('Open :title in lightbox', ['title' => __($item['title'])])"
                        >
                            <x-ui.aspect-ratio ratio="1" class="rounded-lg">
                                <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}"></div>

                                {{-- Hover overlay: caption + expand affordance --}}
                                <div class="absolute inset-0 flex flex-col justify-end bg-gradient-to-t from-foreground/70 via-foreground/0 to-foreground/0 p-4 opacity-0 transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100">
                                    <p class="text-sm font-medium text-background">{{ __($item['category']) }}</p>
                                    <p class="text-sm font-semibold text-background line-clamp-1">{{ __($item['title']) }}</p>
                                </div>

                                <span class="absolute end-2 top-2 inline-flex size-7 items-center justify-center rounded-md bg-background/80 text-foreground opacity-0 backdrop-blur transition-opacity duration-200 group-hover:opacity-100 group-focus-visible:opacity-100">
                                    <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="M15 3h6v6" />
                                        <path d="M9 21H3v-6" />
                                        <path d="M21 3l-7 7" />
                                        <path d="M3 21l7-7" />
                                    </svg>
                                </span>
                            </x-ui.aspect-ratio>
                        </x-ui.dialog.trigger>

                        <x-ui.dialog.content class="max-w-3xl">
                            <figure>
                                <x-ui.aspect-ratio ratio="16 / 10" class="rounded-lg border border-border">
                                    <div class="absolute inset-0 bg-gradient-to-br {{ $item['tone'] }}"></div>
                                </x-ui.aspect-ratio>
                                <figcaption class="mt-4">
                                    <x-ui.dialog.title>{{ __($item['title']) }}</x-ui.dialog.title>
                                    <x-ui.dialog.description class="mt-2">{{ __($item['category']) }}</x-ui.dialog.description>
                                </figcaption>
                            </figure>
                        </x-ui.dialog.content>
                    </x-ui.dialog>
                </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.0.4
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0