Media Content Slider
Alternating media-and-content sliders — paired image + text slides stepped by controls and dots.
Preview
@props([
'eyebrow' => 'Why Monogram',
'heading' => 'Crafted around the details that matter',
'slides' => null,
])
@php
$slides ??= [
[
'eyebrow' => 'Considered materials',
'title' => 'Full-grain leather, sourced responsibly',
'copy' => 'Every piece begins with traceable hides from tanneries we have partnered with for years — chosen for character, longevity and a finish that ages with you.',
'cta' => ['label' => 'Explore the collection', 'href' => '#'],
],
[
'eyebrow' => 'Made to last',
'title' => 'Hardware engineered for daily wear',
'copy' => 'Solid brass fittings, reinforced stress points and double-stitched seams mean a bag that travels from first commute to tenth season without complaint.',
'cta' => ['label' => 'See the craftsmanship', 'href' => '#'],
],
[
'eyebrow' => 'Designed for you',
'title' => 'A silhouette refined over many seasons',
'copy' => 'Balanced proportions, an interior that organises itself and a profile that sits as comfortably in a meeting as it does on a weekend away.',
'cta' => ['label' => 'Find your style', 'href' => '#'],
],
];
$slides = array_values($slides);
$count = count($slides);
$carouselId = 'media-content-slider-'.\Illuminate\Support\Str::uuid();
@endphp
{{--
media-content-slider-01 — "Why Monogram" features slider.
A single-slide-at-a-time editorial slider: each slide pairs a token `bg-muted`
media placeholder (no external image) with an alternating editorial text block
(eyebrow, large `font-heading` title, copy, optional CTA). Inline Alpine tracks
`activeSlide`; prev/next icon buttons and a dot rail step through slides with an
x-show fade/translate transition. RTL-aware: layout order, logical spacing and
the chevron icons mirror under dir="rtl".
Composes <x-ui.button>.
Semantic tokens only, logical spacing, WCAG AA, RTL-safe.
--}}
<section
{{ $attributes->merge(['class' => 'bg-background py-16 text-foreground sm:py-20 lg:py-24']) }}
data-slot="media-content-slider"
aria-roledescription="carousel"
aria-label="{{ __($heading) }}"
x-data="{
activeSlide: 0,
count: {{ $count }},
next() { this.activeSlide = (this.activeSlide + 1) % this.count; },
prev() { this.activeSlide = (this.activeSlide - 1 + this.count) % this.count; },
go(i) { this.activeSlide = i; },
}"
>
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
{{-- Section header + controls --}}
<div class="flex flex-col gap-6 sm:flex-row sm:items-end sm:justify-between">
<header class="max-w-2xl">
@if ($eyebrow)
<p class="font-body text-base font-semibold uppercase tracking-widest text-muted-foreground">{{ __($eyebrow) }}</p>
@endif
<h2 class="mt-2 text-balance font-heading text-3xl tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
</header>
{{-- Prev / next controls --}}
<div class="flex shrink-0 items-center gap-2">
<x-ui.button
variant="outline"
size="icon"
type="button"
class="rounded-full"
x-on:click="prev()"
aria-label="{{ __('Previous slide') }}"
>
<svg class="size-5 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m15 18-6-6 6-6" />
</svg>
</x-ui.button>
<x-ui.button
variant="outline"
size="icon"
type="button"
class="rounded-full"
x-on:click="next()"
aria-label="{{ __('Next slide') }}"
>
<svg class="size-5 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m9 18 6-6-6-6" />
</svg>
</x-ui.button>
</div>
</div>
{{-- Slides --}}
<div class="relative mt-10 grid">
@foreach ($slides as $index => $slide)
@php $reverse = $index % 2 === 1; @endphp
<div
id="{{ $carouselId }}-panel-{{ $index }}"
class="col-start-1 row-start-1"
role="tabpanel"
aria-roledescription="slide"
aria-label="{{ __('Slide :n of :total', ['n' => $index + 1, 'total' => $count]) }}"
aria-labelledby="{{ $carouselId }}-tab-{{ $index }}"
x-show="activeSlide === {{ $index }}"
x-cloak
x-transition:enter="transition duration-500 ease-out"
x-transition:enter-start="opacity-0 translate-y-3"
x-transition:enter-end="opacity-100 translate-y-0"
x-bind:aria-hidden="activeSlide === {{ $index }} ? 'false' : 'true'"
>
<div class="grid items-center gap-8 lg:grid-cols-2 lg:gap-16">
{{-- Media placeholder (no external image) --}}
<div class="relative aspect-[4/3] overflow-hidden rounded-lg bg-muted {{ $reverse ? 'lg:order-last' : '' }}">
<svg
class="absolute inset-0 size-full text-muted-foreground/20"
viewBox="0 0 120 90" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
preserveAspectRatio="xMidYMid slice" aria-hidden="true"
>
<circle cx="60" cy="38" r="16" />
<path d="M20 82c0-15.5 17.9-28 40-28s40 12.5 40 28" />
</svg>
</div>
{{-- Editorial content --}}
<div class="flex max-w-xl flex-col items-start gap-4">
@if (!empty($slide['eyebrow']))
<p class="font-body text-base font-semibold uppercase tracking-[0.25em] text-muted-foreground">
{{ __($slide['eyebrow']) }}
</p>
@endif
<h3 class="font-heading text-2xl font-normal leading-tight tracking-tight sm:text-3xl lg:text-4xl">
{{ __($slide['title']) }}
</h3>
@if (!empty($slide['copy']))
<p class="text-pretty text-base leading-relaxed text-muted-foreground sm:text-lg">
{{ __($slide['copy']) }}
</p>
@endif
@if (!empty($slide['cta']['label']))
<x-ui.button :href="$slide['cta']['href'] ?? '#'" :withArrow="true" class="mt-2">
{{ __($slide['cta']['label']) }}
</x-ui.button>
@endif
</div>
</div>
</div>
@endforeach
</div>
{{-- Dot rail --}}
<div class="mt-10 flex items-center justify-center gap-4" role="tablist" aria-label="{{ __('Choose slide') }}">
@foreach ($slides as $index => $slide)
<button
id="{{ $carouselId }}-tab-{{ $index }}"
type="button"
role="tab"
class="flex size-7 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
x-on:click="go({{ $index }})"
x-on:keydown.right.prevent="go(({{ $index }} + 1) % count); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.left.prevent="go(({{ $index }} - 1 + count) % count); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.home.prevent="go(0); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.end.prevent="go(count - 1); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-bind:aria-selected="activeSlide === {{ $index }} ? 'true' : 'false'"
x-bind:tabindex="activeSlide === {{ $index }} ? 0 : -1"
aria-controls="{{ $carouselId }}-panel-{{ $index }}"
aria-label="{{ __('Go to slide :n', ['n' => $index + 1]) }}"
>
<span
x-bind:class="activeSlide === {{ $index }} ? 'w-7 bg-primary' : 'w-2 bg-border hover:bg-muted-foreground'"
class="h-2 rounded-full transition-all duration-300"
aria-hidden="true"
></span>
</button>
@endforeach
</div>
</div>
</section>
Installation
php artisan ui:add blocks/media-content-slider-alternating
Registry contract
Install confidence
php artisan ui:add blocks/media-content-slider-alternating
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.5
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/media-content-slider-alternating.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: Media Content Slider (`media-content-slider-alternating`)
An editorial media-and-content slider that steps through single slides, each pairing a media placeholder with an alternating text block (eyebrow, display title, copy and optional CTA), driven by inline Alpine prev/next controls and a dot rail.
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/media-content-slider-alternating
```
## Render it
```blade
<x-blocks.media-content-slider-alternating />
```
## Props
- `eyebrow` (string, default `Why Monogram`) — Small label shown above the heading.
- `heading` (string, default `Crafted around the details that matter`) — Section heading; also used as the carousel's accessible label.
- `slides` (mixed|null, default `null`) — Rows of {eyebrow, title, copy, cta}; null falls back to a 3-slide sample.
## Use when
- Stepping through single editorial slides that each pair a media placeholder with an alternating text block: eyebrow, title, copy, optional CTA.
- Wanting prev/next icon buttons plus a keyboard-accessible dot rail instead of a multi-item product carousel.
## Avoid when
- Needing to show several items at once side-by-side, or a photo/product carousel; use a gallery or product-carousel block instead.
## Rules
- Render the installed block with `<x-blocks.media-content-slider-alternating />` 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/media-content-slider-alternating
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/media-content-slider-alternating.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
- Stepping through single editorial slides that each pair a media placeholder with an alternating text block: eyebrow, title, copy, optional CTA.
- Wanting prev/next icon buttons plus a keyboard-accessible dot rail instead of a multi-item product carousel.
Avoid when
- Needing to show several items at once side-by-side, or a photo/product carousel; use a gallery or product-carousel block instead.
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.media-content-slider-alternating />
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' => 'Why Monogram',
'heading' => 'Crafted around the details that matter',
'slides' => null,
])
@php
$slides ??= [
[
'eyebrow' => 'Considered materials',
'title' => 'Full-grain leather, sourced responsibly',
'copy' => 'Every piece begins with traceable hides from tanneries we have partnered with for years — chosen for character, longevity and a finish that ages with you.',
'cta' => ['label' => 'Explore the collection', 'href' => '#'],
],
[
'eyebrow' => 'Made to last',
'title' => 'Hardware engineered for daily wear',
'copy' => 'Solid brass fittings, reinforced stress points and double-stitched seams mean a bag that travels from first commute to tenth season without complaint.',
'cta' => ['label' => 'See the craftsmanship', 'href' => '#'],
],
[
'eyebrow' => 'Designed for you',
'title' => 'A silhouette refined over many seasons',
'copy' => 'Balanced proportions, an interior that organises itself and a profile that sits as comfortably in a meeting as it does on a weekend away.',
'cta' => ['label' => 'Find your style', 'href' => '#'],
],
];
$slides = array_values($slides);
$count = count($slides);
$carouselId = 'media-content-slider-'.\Illuminate\Support\Str::uuid();
@endphp
{{--
media-content-slider-01 — "Why Monogram" features slider.
A single-slide-at-a-time editorial slider: each slide pairs a token `bg-muted`
media placeholder (no external image) with an alternating editorial text block
(eyebrow, large `font-heading` title, copy, optional CTA). Inline Alpine tracks
`activeSlide`; prev/next icon buttons and a dot rail step through slides with an
x-show fade/translate transition. RTL-aware: layout order, logical spacing and
the chevron icons mirror under dir="rtl".
Composes <x-ui.button>.
Semantic tokens only, logical spacing, WCAG AA, RTL-safe.
--}}
<section
{{ $attributes->merge(['class' => 'bg-background py-16 text-foreground sm:py-20 lg:py-24']) }}
data-slot="media-content-slider"
aria-roledescription="carousel"
aria-label="{{ __($heading) }}"
x-data="{
activeSlide: 0,
count: {{ $count }},
next() { this.activeSlide = (this.activeSlide + 1) % this.count; },
prev() { this.activeSlide = (this.activeSlide - 1 + this.count) % this.count; },
go(i) { this.activeSlide = i; },
}"
>
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
{{-- Section header + controls --}}
<div class="flex flex-col gap-6 sm:flex-row sm:items-end sm:justify-between">
<header class="max-w-2xl">
@if ($eyebrow)
<p class="font-body text-base font-semibold uppercase tracking-widest text-muted-foreground">{{ __($eyebrow) }}</p>
@endif
<h2 class="mt-2 text-balance font-heading text-3xl tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
</header>
{{-- Prev / next controls --}}
<div class="flex shrink-0 items-center gap-2">
<x-ui.button
variant="outline"
size="icon"
type="button"
class="rounded-full"
x-on:click="prev()"
aria-label="{{ __('Previous slide') }}"
>
<svg class="size-5 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m15 18-6-6 6-6" />
</svg>
</x-ui.button>
<x-ui.button
variant="outline"
size="icon"
type="button"
class="rounded-full"
x-on:click="next()"
aria-label="{{ __('Next slide') }}"
>
<svg class="size-5 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="m9 18 6-6-6-6" />
</svg>
</x-ui.button>
</div>
</div>
{{-- Slides --}}
<div class="relative mt-10 grid">
@foreach ($slides as $index => $slide)
@php $reverse = $index % 2 === 1; @endphp
<div
id="{{ $carouselId }}-panel-{{ $index }}"
class="col-start-1 row-start-1"
role="tabpanel"
aria-roledescription="slide"
aria-label="{{ __('Slide :n of :total', ['n' => $index + 1, 'total' => $count]) }}"
aria-labelledby="{{ $carouselId }}-tab-{{ $index }}"
x-show="activeSlide === {{ $index }}"
x-cloak
x-transition:enter="transition duration-500 ease-out"
x-transition:enter-start="opacity-0 translate-y-3"
x-transition:enter-end="opacity-100 translate-y-0"
x-bind:aria-hidden="activeSlide === {{ $index }} ? 'false' : 'true'"
>
<div class="grid items-center gap-8 lg:grid-cols-2 lg:gap-16">
{{-- Media placeholder (no external image) --}}
<div class="relative aspect-[4/3] overflow-hidden rounded-lg bg-muted {{ $reverse ? 'lg:order-last' : '' }}">
<svg
class="absolute inset-0 size-full text-muted-foreground/20"
viewBox="0 0 120 90" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
preserveAspectRatio="xMidYMid slice" aria-hidden="true"
>
<circle cx="60" cy="38" r="16" />
<path d="M20 82c0-15.5 17.9-28 40-28s40 12.5 40 28" />
</svg>
</div>
{{-- Editorial content --}}
<div class="flex max-w-xl flex-col items-start gap-4">
@if (!empty($slide['eyebrow']))
<p class="font-body text-base font-semibold uppercase tracking-[0.25em] text-muted-foreground">
{{ __($slide['eyebrow']) }}
</p>
@endif
<h3 class="font-heading text-2xl font-normal leading-tight tracking-tight sm:text-3xl lg:text-4xl">
{{ __($slide['title']) }}
</h3>
@if (!empty($slide['copy']))
<p class="text-pretty text-base leading-relaxed text-muted-foreground sm:text-lg">
{{ __($slide['copy']) }}
</p>
@endif
@if (!empty($slide['cta']['label']))
<x-ui.button :href="$slide['cta']['href'] ?? '#'" :withArrow="true" class="mt-2">
{{ __($slide['cta']['label']) }}
</x-ui.button>
@endif
</div>
</div>
</div>
@endforeach
</div>
{{-- Dot rail --}}
<div class="mt-10 flex items-center justify-center gap-4" role="tablist" aria-label="{{ __('Choose slide') }}">
@foreach ($slides as $index => $slide)
<button
id="{{ $carouselId }}-tab-{{ $index }}"
type="button"
role="tab"
class="flex size-7 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
x-on:click="go({{ $index }})"
x-on:keydown.right.prevent="go(({{ $index }} + 1) % count); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.left.prevent="go(({{ $index }} - 1 + count) % count); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.home.prevent="go(0); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-on:keydown.end.prevent="go(count - 1); $nextTick(() => $el.parentElement.children[activeSlide].focus())"
x-bind:aria-selected="activeSlide === {{ $index }} ? 'true' : 'false'"
x-bind:tabindex="activeSlide === {{ $index }} ? 0 : -1"
aria-controls="{{ $carouselId }}-panel-{{ $index }}"
aria-label="{{ __('Go to slide :n', ['n' => $index + 1]) }}"
>
<span
x-bind:class="activeSlide === {{ $index }} ? 'w-7 bg-primary' : 'w-2 bg-border hover:bg-muted-foreground'"
class="h-2 rounded-full transition-all duration-300"
aria-hidden="true"
></span>
</button>
@endforeach
</div>
</div>
</section>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.5 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0