Skip to content
Brok UI

Loading…

No results

Gallery

Open source

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

Preview

5 of 6

resources/views/blocks/gallery-split.blade.php Blade
@props([
    'eyebrow'    => 'Gallery',
    'heading'    => 'Behind the lens',
    'subheading' => 'A curated selection of work — one image in focus, the rest ready to explore.',
    'images'     => null,
    'loop'       => true,
])

@php
    $images ??= [
        ['title' => 'Golden hour on the ridge', 'category' => 'Landscape', 'tone' => 'from-primary/40 via-secondary/25 to-background'],
        ['title' => 'Studio still life', 'category' => 'Still life', 'tone' => 'from-primary/30 via-muted to-background'],
        ['title' => 'Workshop afternoon', 'category' => 'Process', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Atrium light study', 'category' => 'Architecture', 'tone' => 'from-muted via-background to-primary/20'],
        ['title' => 'Evening skyline', 'category' => 'Landscape', 'tone' => 'from-primary/30 via-secondary/30 to-background'],
        ['title' => 'Material samples', 'category' => 'Detail', 'tone' => 'from-secondary/30 via-muted to-background'],
        ['title' => 'Prototype review', 'category' => 'Process', 'tone' => 'from-muted via-primary/20 to-secondary/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" />

        {{-- Real carousel: previous/next move the featured slide and the track;
             thumbnails jump straight to a slide via the shared carousel state. --}}
        <x-ui.carousel :loop="$loop" class="mt-12 grid gap-4 lg:grid-cols-[2fr_1fr]" aria-label="{{ __($heading) }}">
            <div class="relative overflow-hidden rounded-lg border border-border bg-card shadow-sm">
                <x-ui.carousel.content>
                    @foreach ($images as $image)
                        <x-ui.carousel.item>
                            <figure data-slot="gallery-featured">
                                <div class="aspect-[4/3] w-full bg-gradient-to-br {{ $image['tone'] }}"></div>
                                <figcaption class="flex items-center justify-between gap-4 border-t border-border bg-card p-4">
                                    <p class="min-w-0 flex-1 truncate text-sm font-semibold text-foreground">{{ __($image['title']) }}</p>
                                    @if (! empty($image['category']))
                                        <x-ui.badge variant="secondary" class="shrink-0">{{ __($image['category']) }}</x-ui.badge>
                                    @endif
                                </figcaption>
                            </figure>
                        </x-ui.carousel.item>
                    @endforeach
                </x-ui.carousel.content>

                <x-ui.carousel.previous />
                <x-ui.carousel.next />
            </div>

            <div class="grid grid-cols-2 content-start gap-2" role="list" aria-label="{{ __('Gallery thumbnails') }}">
                @foreach ($images as $i => $image)
                    <button
                        type="button"
                        role="listitem"
                        data-slot="gallery-thumbnail"
                        x-on:click="goTo({{ $i }})"
                        x-bind:aria-current="index === {{ $i }} ? 'true' : 'false'"
                        x-bind:class="index === {{ $i }} ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''"
                        class="group relative overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-shadow focus-visible:outline-none focus-visible:ring-[length:var(--ring-width)] focus-visible:ring-ring"
                    >
                        <span class="sr-only">{{ __($image['title']) }}</span>
                        <div class="aspect-square w-full bg-gradient-to-br {{ $image['tone'] }}" aria-hidden="true"></div>
                    </button>
                @endforeach
            </div>
        </x-ui.carousel>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/gallery-split

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

badge carousel container section section-heading

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-split.md
# Brok UI block: Gallery Split (`gallery-split`)

A split gallery pairing one large featured slide with caption and working prev/next controls beside a two-column strip of thumbnails that jump straight to a slide, composing the carousel primitive.

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

## Render it

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

## Props

- `eyebrow` (string, default `Gallery`) — Small badge label shown above the heading.
- `heading` (string, default `Behind the lens`) — Main section heading text.
- `subheading` (string, default `A curated selection of work — one image in focus, the rest ready to explore.`) — Supporting subheading text below the heading.
- `images` (mixed|null, default `null`) — Array of gallery images ({title, category, tone}); defaults to a built-in set of seven sample images.
- `loop` (bool, default `true`) — Whether the carousel wraps from the last slide back to the first.

## Use when

- Pairing one large featured image with a thumbnail strip that jumps straight to any slide.
- Showing a working previous/next carousel alongside a caption and category badge for the active image.

## Avoid when

- Use gallery-carousel instead for a simple multi-item carousel without a thumbnail strip.

## Rules

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

  • Pairing one large featured image with a thumbnail strip that jumps straight to any slide.
  • Showing a working previous/next carousel alongside a caption and category badge for the active image.

Avoid when

  • Use gallery-carousel instead for a simple multi-item carousel without a thumbnail strip.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
root gallery-featured gallery-thumbnail

Usage

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

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

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-split.blade.php Blade
@props([
    'eyebrow'    => 'Gallery',
    'heading'    => 'Behind the lens',
    'subheading' => 'A curated selection of work — one image in focus, the rest ready to explore.',
    'images'     => null,
    'loop'       => true,
])

@php
    $images ??= [
        ['title' => 'Golden hour on the ridge', 'category' => 'Landscape', 'tone' => 'from-primary/40 via-secondary/25 to-background'],
        ['title' => 'Studio still life', 'category' => 'Still life', 'tone' => 'from-primary/30 via-muted to-background'],
        ['title' => 'Workshop afternoon', 'category' => 'Process', 'tone' => 'from-secondary/40 via-muted to-background'],
        ['title' => 'Atrium light study', 'category' => 'Architecture', 'tone' => 'from-muted via-background to-primary/20'],
        ['title' => 'Evening skyline', 'category' => 'Landscape', 'tone' => 'from-primary/30 via-secondary/30 to-background'],
        ['title' => 'Material samples', 'category' => 'Detail', 'tone' => 'from-secondary/30 via-muted to-background'],
        ['title' => 'Prototype review', 'category' => 'Process', 'tone' => 'from-muted via-primary/20 to-secondary/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" />

        {{-- Real carousel: previous/next move the featured slide and the track;
             thumbnails jump straight to a slide via the shared carousel state. --}}
        <x-ui.carousel :loop="$loop" class="mt-12 grid gap-4 lg:grid-cols-[2fr_1fr]" aria-label="{{ __($heading) }}">
            <div class="relative overflow-hidden rounded-lg border border-border bg-card shadow-sm">
                <x-ui.carousel.content>
                    @foreach ($images as $image)
                        <x-ui.carousel.item>
                            <figure data-slot="gallery-featured">
                                <div class="aspect-[4/3] w-full bg-gradient-to-br {{ $image['tone'] }}"></div>
                                <figcaption class="flex items-center justify-between gap-4 border-t border-border bg-card p-4">
                                    <p class="min-w-0 flex-1 truncate text-sm font-semibold text-foreground">{{ __($image['title']) }}</p>
                                    @if (! empty($image['category']))
                                        <x-ui.badge variant="secondary" class="shrink-0">{{ __($image['category']) }}</x-ui.badge>
                                    @endif
                                </figcaption>
                            </figure>
                        </x-ui.carousel.item>
                    @endforeach
                </x-ui.carousel.content>

                <x-ui.carousel.previous />
                <x-ui.carousel.next />
            </div>

            <div class="grid grid-cols-2 content-start gap-2" role="list" aria-label="{{ __('Gallery thumbnails') }}">
                @foreach ($images as $i => $image)
                    <button
                        type="button"
                        role="listitem"
                        data-slot="gallery-thumbnail"
                        x-on:click="goTo({{ $i }})"
                        x-bind:aria-current="index === {{ $i }} ? 'true' : 'false'"
                        x-bind:class="index === {{ $i }} ? 'ring-2 ring-primary ring-offset-2 ring-offset-background' : ''"
                        class="group relative overflow-hidden rounded-lg border border-border bg-card shadow-sm transition-shadow focus-visible:outline-none focus-visible:ring-[length:var(--ring-width)] focus-visible:ring-ring"
                    >
                        <span class="sr-only">{{ __($image['title']) }}</span>
                        <div class="aspect-square w-full bg-gradient-to-br {{ $image['tone'] }}" aria-hidden="true"></div>
                    </button>
                @endforeach
            </div>
        </x-ui.carousel>
    </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