Gallery
Image galleries — a masonry wall and a uniform grid with a lightbox.
Preview
@props([
'eyebrow' => 'Gallery',
'heading' => 'Our work',
'subheading' => 'Swipe through a selection of recent projects, studies, and details.',
'items' => null,
'loop' => true,
])
@php
$items ??= [
['title' => 'Atrium light study', 'category' => 'Architecture'],
['title' => 'Workshop in progress', 'category' => 'Process'],
['title' => 'Material samples', 'category' => 'Detail'],
['title' => 'Evening skyline', 'category' => 'Landscape'],
['title' => 'Quiet corner', 'category' => 'Interior'],
['title' => 'On location', 'category' => 'Field'],
];
@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" />
<x-ui.carousel :loop="$loop" class="mt-12 px-12 sm:mt-16 sm:px-14" aria-label="{{ __('Gallery') }}">
<x-ui.carousel.content>
@foreach ($items as $item)
<x-ui.carousel.item class="basis-full px-2 sm:basis-1/2 lg:basis-1/3">
<figure class="h-full">
<x-ui.aspect-ratio ratio="4 / 3" class="rounded-lg border border-border bg-muted">
<div class="absolute inset-0 flex items-center justify-center text-muted-foreground">
<svg class="size-10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
</svg>
</div>
</x-ui.aspect-ratio>
<figcaption class="mt-4 px-2">
<p class="text-sm font-semibold text-foreground">{{ __($item['title']) }}</p>
<p class="mt-0.5 text-sm text-muted-foreground">{{ __($item['category']) }}</p>
</figcaption>
</figure>
</x-ui.carousel.item>
@endforeach
</x-ui.carousel.content>
<x-ui.carousel.previous />
<x-ui.carousel.next />
</x-ui.carousel>
</x-ui.container>
</x-ui.section>
Installation
php artisan ui:add blocks/gallery-carousel
Registry contract
Install confidence
php artisan ui:add blocks/gallery-carousel
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-carousel.blade.php |
Registry dependencies
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.
# Brok UI block: Gallery Carousel (`gallery-carousel`)
A swipeable media gallery built on the carousel primitive, showing multiple token-styled image figures per view with title and category captions and accessible prev/next 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/gallery-carousel
```
## Render it
```blade
<x-blocks.gallery-carousel />
```
## Props
- `eyebrow` (string, default `Gallery`) — Small badge label shown above the heading.
- `heading` (string, default `Our work`) — Main section heading text.
- `subheading` (string, default `Swipe through a selection of recent projects, studies, and details.`) — Supporting subheading text below the heading.
- `items` (mixed|null, default `null`) — Array of gallery items ({title, category}); defaults to a built-in set of six sample items.
- `loop` (bool, default `true`) — Whether the carousel wraps from the last slide back to the first.
## Use when
- Presenting a horizontally swipeable set of images with visible previous and next controls.
- Showing multiple image figures per view with a title and category caption beneath each.
## Avoid when
- Use gallery-masonry or gallery-filtered instead for a static grid that shows every image at once without swiping.
## Rules
- Render the installed block with `<x-blocks.gallery-carousel />` 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-carousel
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/gallery-carousel.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
- Presenting a horizontally swipeable set of images with visible previous and next controls.
- Showing multiple image figures per view with a title and category caption beneath each.
Avoid when
- Use gallery-masonry or gallery-filtered instead for a static grid that shows every image at once without swiping.
Anti-patterns
- Do not replace semantic props with conflicting utility classes.
- Do not remove labels, focus styles, or state attributes.
- Anatomy
Usage
Render the block as a component, passing data where useful:
<x-blocks.gallery-carousel />
Built from primitives
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.
@props([
'eyebrow' => 'Gallery',
'heading' => 'Our work',
'subheading' => 'Swipe through a selection of recent projects, studies, and details.',
'items' => null,
'loop' => true,
])
@php
$items ??= [
['title' => 'Atrium light study', 'category' => 'Architecture'],
['title' => 'Workshop in progress', 'category' => 'Process'],
['title' => 'Material samples', 'category' => 'Detail'],
['title' => 'Evening skyline', 'category' => 'Landscape'],
['title' => 'Quiet corner', 'category' => 'Interior'],
['title' => 'On location', 'category' => 'Field'],
];
@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" />
<x-ui.carousel :loop="$loop" class="mt-12 px-12 sm:mt-16 sm:px-14" aria-label="{{ __('Gallery') }}">
<x-ui.carousel.content>
@foreach ($items as $item)
<x-ui.carousel.item class="basis-full px-2 sm:basis-1/2 lg:basis-1/3">
<figure class="h-full">
<x-ui.aspect-ratio ratio="4 / 3" class="rounded-lg border border-border bg-muted">
<div class="absolute inset-0 flex items-center justify-center text-muted-foreground">
<svg class="size-10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
</svg>
</div>
</x-ui.aspect-ratio>
<figcaption class="mt-4 px-2">
<p class="text-sm font-semibold text-foreground">{{ __($item['title']) }}</p>
<p class="mt-0.5 text-sm text-muted-foreground">{{ __($item['category']) }}</p>
</figcaption>
</figure>
</x-ui.carousel.item>
@endforeach
</x-ui.carousel.content>
<x-ui.carousel.previous />
<x-ui.carousel.next />
</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.0.4 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0