Skip to content
Brok UI

Loading…

No results

Stack Ripple

Open source

Three notification cards that rest as an overlapping deck and fan into a column when toggled, via CSS-only translate/scale transitions. The toggle exposes aria-expanded / aria-controls.

Version
v1.0.4
Stability
stable
License
MIT
Related
Draggable Card Stack
Layered Stack
Carousel

Preview

New Message

Acme Inc

3 hrs ago

User Signed Up

Acme Inc

7 hrs ago

Billing Reminder

Acme Inc

9 hrs ago
previews.components.stack-ripple.default.blade.php Blade
<div class="w-full flex justify-center p-6">
    <x-ui.stack-ripple />
</div>

Installation

terminal
php artisan ui:add stack-ripple

Note

This component ships an Alpine behavior module at resources/js/ui/stack-ripple.js. Import it once from your bundle so it registers on alpine:init:

resources/js/ui/index.js JS
import './stack-ripple.js';

Registry contract

php artisan ui:add stack-ripple writes only the files below. The CLI validates each file hash before writing and asks before it replaces a local change, unless you pass --force.

  • blade resources/views/components/ui/stack-ripple.blade.php
  • js resources/js/ui/stack-ripple.js
Registry dependencies
None — installs on its own.
Packages
composer: jml/brok:^0.2
npm: alpinejs

Use with AI

A brief for your coding agent: install command, usage, props, guidance and the rules. Copy it, or open a prompt about this component in an assistant.

stack-ripple.md
# Brok UI: Stack Ripple (`stack-ripple`)

Three notification cards that rest as an overlapping deck and fan into a column when toggled, via CSS-only translate/scale transitions. The toggle exposes aria-expanded / aria-controls.

Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.

## Install

```bash
php artisan ui:add stack-ripple
```

## Usage

```blade
<div class="w-full flex justify-center p-6">
    <x-ui.stack-ripple />
</div>
```

## Props

- `items` (array, default `[…]`) — Notification cards in the deck; each needs icon, title, meta and time.

## Use when

- Use sparingly to celebrate significant completion or add a memorable moment.
- Showing a small set (about three) of notification-style cards compactly as a resting overlapping deck that a visitor can expand into a readable column on demand.
- Wanting a lightweight, CSS-only fan-out toggle rather than a carousel or navigable stack.

## Avoid when

- Do not inject celebration into routine high-frequency workflows or serious contexts.
- The cards need to be individually navigated, reordered, or dismissed; this component only toggles between a collapsed deck and an expanded column. Use draggable-card-stack or layered-stack for that.

## Anti-patterns

- Celebration in routine, serious, or high-frequency workflows

## Rules

- Use the `<brok:stack-ripple>` tag (or `<x-ui.stack-ripple>`) in Blade; do not rewrite the component.
- Prefer the documented props and variants over utility-class overrides; when a utility must win, use the `!` important modifier.
- Use semantic design tokens (`bg-primary`, `text-muted-foreground`), never raw colour utilities.
- Keep the `data-slot` attributes; they are the styling and test hooks.

## Links

- Docs: https://brokui.dev/docs/components/stack-ripple
- Registry JSON (files, props, contract): https://brokui.dev/r/open/stack-ripple.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

API

manifest knowledge + registry-derived coverage

Props

Props accepted by this component: name, type, default value and description.
Prop Type Default Description
items array […] Notification cards in the deck; each needs icon, title, meta and time.

Slots

  • default — Unused; cards are rendered from the items prop.

Data slots

Stable hooks for CSS overrides and browser tests.

stack-ripple

Behavior

  • Three cards rest as an overlapping deck by default; toggling Show all fans them into a vertical column via CSS-only translate/scale/opacity transitions, and toggling again collapses them back.
  • The motion is disabled under prefers-reduced-motion.
  • Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
  • Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized, reducedMotion.

Guidance

Celebration effect

Celebrate a meaningful completion moment.

Use when

  • Use sparingly to celebrate significant completion or add a memorable moment.
  • Showing a small set (about three) of notification-style cards compactly as a resting overlapping deck that a visitor can expand into a readable column on demand.
  • Wanting a lightweight, CSS-only fan-out toggle rather than a carousel or navigable stack.

Avoid when

  • Do not inject celebration into routine high-frequency workflows or serious contexts.
  • The cards need to be individually navigated, reordered, or dismissed; this component only toggles between a collapsed deck and an expanded column. Use draggable-card-stack or layered-stack for that.

Use instead

  • Concise success message

Anti-patterns

  • Celebration in routine, serious, or high-frequency workflows
Anatomy
root
Theming hooks
stack-ripple

Accessibility

WCAG 2.2 AA Keyboard focus-visible RTL-ready Localized labels Dark mode
Keyboard
native
Focus
native
  • The toggle button exposes aria-expanded and aria-controls pointing at the card deck, so assistive tech tracks the expanded/collapsed state.
  • The chevron icon on the toggle is decorative (aria-hidden) and only reinforces the state visually.
  • Semantic HTML and a stable data-slot attribute for styling and scripting hooks.
  • Focus-visible rings use the ring token, so keyboard focus is always visible.
  • Disabled and invalid states are conveyed to assistive tech, not by color alone.
  • Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces in the preview.
  • Labels go through __() and layout uses logical properties (ms-*, text-start), so it mirrors under dir="rtl" — flip the preview to RTL to confirm.
  • Dark mode uses the same semantic tokens under the dark class; high contrast follows forced-color system tokens.

Livewire

Needs wire:key

Add a stable wire:key when Livewire can reorder this interactive component.

livewire-component.blade.php Blade
<div wire:key="stack-ripple-{{ $record->id }}">
    <div class="w-full flex justify-center p-6">
        <x-ui.stack-ripple />
    </div>
</div>

Validation

Validation support: native. Keep the error message connected with aria-describedby.

livewire-form.blade.php Blade
<form wire:submit="save" class="space-y-2">
    <brok:stack-ripple
        wire:model="value"
        :aria-invalid="$errors->has('value') ? 'true' : 'false'"
        aria-describedby="value-error"
    />

    @error('value')
        <p id="value-error" role="alert">{{ $message }}</p>
    @enderror

    <brok:button type="submit" wire:loading.attr="disabled">
        <span wire:loading.remove>Save</span>
        <span wire:loading>Saving…</span>
    </brok:button>
</form>

Source

The exact, editable files ui:add writes into your app. Previews render this same code; there are no preview-only components.

resources/views/components/ui/stack-ripple.blade.php Blade
@props([
    // Each card: icon (glyph name), title, meta, time.
    'items' => [
        ['icon' => 'message', 'title' => 'New Message', 'meta' => 'Acme Inc', 'time' => '3 hrs ago'],
        ['icon' => 'user', 'title' => 'User Signed Up', 'meta' => 'Acme Inc', 'time' => '7 hrs ago'],
        ['icon' => 'card', 'title' => 'Billing Reminder', 'meta' => 'Acme Inc', 'time' => '9 hrs ago'],
    ],
])

@php
    $glyphs = [
        'message' => 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',
        'user' => 'M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8',
        'card' => 'M2 5h20v14H2zM2 10h20',
    ];
    $items = array_values($items);

    // Per-card open/closed transforms (top / middle / bottom). v4 translate +
    // scale are independent properties, so they compose cleanly.
    $states = [
        ['z-10', 'open ? \'-translate-y-[4.75rem] scale-100 opacity-100\' : \'-translate-y-1 scale-95 opacity-80\''],
        ['z-30', 'open ? \'translate-y-0 scale-100\' : \'translate-y-0 scale-100\''],
        ['z-20', 'open ? \'translate-y-[4.75rem] scale-100 opacity-100\' : \'translate-y-1 scale-95 opacity-80\''],
    ];
@endphp

{{-- Stack Ripple: three notification cards that rest as an overlapping deck and
     fan into a column when toggled. Motion is CSS-only (reduced motion disables
     the transitions); the toggle exposes aria-expanded / aria-controls. --}}
<div
    data-slot="stack-ripple"
    x-data="uiStackRipple()"
    {{ $attributes->merge(['class' => 'relative mx-auto w-full max-w-sm']) }}
>
    <div id="stack-ripple-deck" class="relative h-64">
        @foreach ($items as $i => $item)
            <div
                class="absolute inset-x-0 top-1/2 mx-auto -mt-7 flex w-[88%] items-center justify-between rounded-md border border-border bg-card px-3 py-2 text-card-foreground shadow-sm transition-all duration-500 ease-out motion-reduce:transition-none {{ $states[$i][0] }}"
                :class="{{ $states[$i][1] }}"
            >
                <div class="flex items-center gap-2">
                    <span class="flex size-10 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground">
                        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-5" aria-hidden="true">
                            <path d="{{ $glyphs[$item['icon'] ?? 'message'] ?? $glyphs['message'] }}" />
                        </svg>
                    </span>
                    <div class="flex flex-col">
                        <p class="text-xs font-medium text-foreground">{{ __($item['title']) }}</p>
                        <p class="text-2xs text-muted-foreground">{{ __($item['meta']) }}</p>
                    </div>
                </div>
                <span class="text-2xs text-muted-foreground">{{ __($item['time']) }}</span>
            </div>
        @endforeach
    </div>

    <button
        type="button"
        @click="toggle()"
        :aria-expanded="open ? 'true' : 'false'"
        aria-controls="stack-ripple-deck"
        class="mx-auto flex h-8 w-24 items-center justify-center gap-1 rounded-md border border-border bg-card text-xs text-muted-foreground shadow-sm transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
    >
        <span x-text="open ? '{{ __('Hide') }}' : '{{ __('Show all') }}'">{{ __('Show all') }}</span>
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-4 transition-transform duration-300 motion-reduce:transition-none" :class="open && 'rotate-180'" aria-hidden="true">
            <path d="m6 9 6 6 6-6" />
        </svg>
    </button>
</div>
resources/js/ui/stack-ripple.js JS
/**
 * Stack Ripple behaviour (stacked cards that fan out on toggle).
 *
 * Three notification cards rest as an overlapping deck; toggling "Show all" fans
 * them into a vertical column and back. The motion is pure CSS (each card's
 * translate/scale/opacity is class-bound to `open` and transitions), so this
 * layer only tracks `open` and exposes `toggle()` — no timers, listeners or
 * observers, hence nothing to tear down.
 *
 * Self-registers on `alpine:init` so import order does not matter.
 *
 * Note: this file is plain JS served by the registry — no Blade syntax allowed.
 */
document.addEventListener('alpine:init', () => {
    window.Alpine.data('uiStackRipple', (config = {}) => ({
        open: Boolean(config.open ?? false),

        toggle() {
            this.open = !this.open;
        },
    }));
});

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
Accessibility reviewed
No review date recorded
Last breaking change
No date recorded
Deprecation
Not deprecated
Contract
v6
Foundation
≥ 1.0.0