Skip to content
Brok UI

Loading…

No results

Wishlist

Open source

Saved-item wishlists — a card grid and a data-dense table layout.

Preview

1 of 2

resources/views/blocks/wishlist-grid.blade.php Blade
@props([
    'heading' => 'Your wishlist',
    'subheading' => 'Saved for later. Move items to your cart while they are still in stock.',
    'items' => null,
    'currency' => 'USD',
])

@php
    $items ??= [
        [
            'name' => 'Aero Knit Runner',
            'category' => 'Footwear',
            'price' => '118',
            'compareAt' => '148',
            'rating' => 4.5,
            'reviews' => 214,
            'inStock' => true,
        ],
        [
            'name' => 'Merino Travel Crew',
            'category' => 'Knitwear',
            'price' => '96',
            'compareAt' => null,
            'rating' => 5,
            'reviews' => 88,
            'inStock' => true,
        ],
        [
            'name' => 'Cascade Weatherproof Shell',
            'category' => 'Outerwear',
            'price' => '214',
            'compareAt' => '260',
            'rating' => 4,
            'reviews' => 132,
            'inStock' => false,
        ],
        [
            'name' => 'Field Canvas Tote',
            'category' => 'Accessories',
            'price' => '72',
            'compareAt' => null,
            'rating' => 4.5,
            'reviews' => 47,
            'inStock' => true,
        ],
        [
            'name' => 'Studio Linen Shirt',
            'category' => 'Shirts',
            'price' => '84',
            'compareAt' => '110',
            'rating' => 4,
            'reviews' => 309,
            'inStock' => true,
        ],
        [
            'name' => 'Coast Wool Beanie',
            'category' => 'Accessories',
            'price' => '34',
            'compareAt' => null,
            'rating' => null,
            'reviews' => null,
            'inStock' => false,
        ],
    ];

    $savedCount = count($items);
@endphp

<x-ui.section
    aria-label="{{ __('Wishlist') }}"
    data-slot="wishlist-01"
    space="lg" {{ $attributes }}
>
    <x-ui.container gutter="sm">
        <header class="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">
            <div class="max-w-2xl">
                <h2 class="text-balance text-2xl font-bold tracking-tight sm:text-3xl">{{ __($heading) }}</h2>
                @if ($subheading)
                    <p class="mt-2 text-pretty text-sm text-muted-foreground sm:text-base">{{ __($subheading) }}</p>
                @endif
            </div>
            <p class="shrink-0 text-sm font-medium text-muted-foreground" aria-live="polite">
                {{ trans_choice(':count item saved|:count items saved', $savedCount, ['count' => $savedCount]) }}
            </p>
        </header>

        <ul role="list" class="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
            @foreach ($items as $item)
                @php
                    $inStock = ! empty($item['inStock']);
                    $card = [
                        'name' => $item['name'],
                        'href' => $item['href'] ?? '#',
                        'category' => $item['category'] ?? null,
                        'price' => $item['price'],
                        'compareAt' => $item['compareAt'] ?? null,
                        'rating' => $item['rating'] ?? null,
                        'reviews' => $item['reviews'] ?? null,
                        'badge' => $inStock ? 'In stock' : 'Out of stock',
                        'badgeVariant' => $inStock ? 'secondary' : 'outline',
                        'gradient' => 'from-muted to-accent',
                    ];
                @endphp
                <li>
                    <x-ui.product-card :product="$card" :currency="$currency" :show-wishlist="false">
                        <x-slot:actions>
                            <div class="flex items-center gap-2">
                                <x-ui.button
                                    variant="default"
                                    size="sm"
                                    type="button"
                                    class="flex-1"
                                    :disabled="! $inStock"
                                    :aria-label="__('Move :name to cart', ['name' => $item['name']])"
                                >
                                    <x-slot:icon>
                                        <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">
                                            <circle cx="9" cy="21" r="1" />
                                            <circle cx="20" cy="21" r="1" />
                                            <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6" />
                                        </svg>
                                    </x-slot:icon>
                                    {{ $inStock ? __('Move to cart') : __('Notify me') }}
                                </x-ui.button>
                                <x-ui.button
                                    variant="ghost"
                                    size="icon-sm"
                                    type="button"
                                    :aria-label="__('Remove :name from wishlist', ['name' => $item['name']])"
                                    class="shrink-0 text-muted-foreground hover:text-destructive"
                                >
                                    <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="M18 6 6 18" />
                                        <path d="m6 6 12 12" />
                                    </svg>
                                </x-ui.button>
                            </div>
                        </x-slot:actions>
                    </x-ui.product-card>
                </li>
            @endforeach
        </ul>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/wishlist-grid

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/wishlist-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.1.2
License
open
Stability
stable
Contract
v1
Foundation
≥ 1.0.0
Type Generated target
blade resources/views/blocks/wishlist-grid.blade.php

Registry dependencies

button container product-card section

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.

wishlist-grid.md
# Brok UI block: Wishlist (`wishlist-grid`)

Saved-items wishlist grid with stock badges, ratings, pricing and move-to-cart actions.

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

## Render it

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

## Props

- `heading` (string, default `Your wishlist`) — Section heading.
- `subheading` (string, default `Saved for later. Move items to your cart while they are still in stock.`) — Supporting copy under the heading.
- `items` (mixed|null, default `null`) — Saved product entries with name, category, price, rating and stock state; null falls back to sample data.
- `currency` (string, default `USD`) — Currency symbol or code used to format prices.

## Use when

- Showing saved items in a product-card grid with stock badges, ratings and move-to-cart actions.
- Using it as the default wishlist layout on a storefront.

## Avoid when

- Needing a dense, tabular wishlist view; use wishlist-table instead.

## Rules

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

  • Showing saved items in a product-card grid with stock badges, ratings and move-to-cart actions.
  • Using it as the default wishlist layout on a storefront.

Avoid when

  • Needing a dense, tabular wishlist view; use wishlist-table instead.

Anti-patterns

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

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.wishlist-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/wishlist-grid.blade.php Blade
@props([
    'heading' => 'Your wishlist',
    'subheading' => 'Saved for later. Move items to your cart while they are still in stock.',
    'items' => null,
    'currency' => 'USD',
])

@php
    $items ??= [
        [
            'name' => 'Aero Knit Runner',
            'category' => 'Footwear',
            'price' => '118',
            'compareAt' => '148',
            'rating' => 4.5,
            'reviews' => 214,
            'inStock' => true,
        ],
        [
            'name' => 'Merino Travel Crew',
            'category' => 'Knitwear',
            'price' => '96',
            'compareAt' => null,
            'rating' => 5,
            'reviews' => 88,
            'inStock' => true,
        ],
        [
            'name' => 'Cascade Weatherproof Shell',
            'category' => 'Outerwear',
            'price' => '214',
            'compareAt' => '260',
            'rating' => 4,
            'reviews' => 132,
            'inStock' => false,
        ],
        [
            'name' => 'Field Canvas Tote',
            'category' => 'Accessories',
            'price' => '72',
            'compareAt' => null,
            'rating' => 4.5,
            'reviews' => 47,
            'inStock' => true,
        ],
        [
            'name' => 'Studio Linen Shirt',
            'category' => 'Shirts',
            'price' => '84',
            'compareAt' => '110',
            'rating' => 4,
            'reviews' => 309,
            'inStock' => true,
        ],
        [
            'name' => 'Coast Wool Beanie',
            'category' => 'Accessories',
            'price' => '34',
            'compareAt' => null,
            'rating' => null,
            'reviews' => null,
            'inStock' => false,
        ],
    ];

    $savedCount = count($items);
@endphp

<x-ui.section
    aria-label="{{ __('Wishlist') }}"
    data-slot="wishlist-01"
    space="lg" {{ $attributes }}
>
    <x-ui.container gutter="sm">
        <header class="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between">
            <div class="max-w-2xl">
                <h2 class="text-balance text-2xl font-bold tracking-tight sm:text-3xl">{{ __($heading) }}</h2>
                @if ($subheading)
                    <p class="mt-2 text-pretty text-sm text-muted-foreground sm:text-base">{{ __($subheading) }}</p>
                @endif
            </div>
            <p class="shrink-0 text-sm font-medium text-muted-foreground" aria-live="polite">
                {{ trans_choice(':count item saved|:count items saved', $savedCount, ['count' => $savedCount]) }}
            </p>
        </header>

        <ul role="list" class="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
            @foreach ($items as $item)
                @php
                    $inStock = ! empty($item['inStock']);
                    $card = [
                        'name' => $item['name'],
                        'href' => $item['href'] ?? '#',
                        'category' => $item['category'] ?? null,
                        'price' => $item['price'],
                        'compareAt' => $item['compareAt'] ?? null,
                        'rating' => $item['rating'] ?? null,
                        'reviews' => $item['reviews'] ?? null,
                        'badge' => $inStock ? 'In stock' : 'Out of stock',
                        'badgeVariant' => $inStock ? 'secondary' : 'outline',
                        'gradient' => 'from-muted to-accent',
                    ];
                @endphp
                <li>
                    <x-ui.product-card :product="$card" :currency="$currency" :show-wishlist="false">
                        <x-slot:actions>
                            <div class="flex items-center gap-2">
                                <x-ui.button
                                    variant="default"
                                    size="sm"
                                    type="button"
                                    class="flex-1"
                                    :disabled="! $inStock"
                                    :aria-label="__('Move :name to cart', ['name' => $item['name']])"
                                >
                                    <x-slot:icon>
                                        <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">
                                            <circle cx="9" cy="21" r="1" />
                                            <circle cx="20" cy="21" r="1" />
                                            <path d="M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6" />
                                        </svg>
                                    </x-slot:icon>
                                    {{ $inStock ? __('Move to cart') : __('Notify me') }}
                                </x-ui.button>
                                <x-ui.button
                                    variant="ghost"
                                    size="icon-sm"
                                    type="button"
                                    :aria-label="__('Remove :name from wishlist', ['name' => $item['name']])"
                                    class="shrink-0 text-muted-foreground hover:text-destructive"
                                >
                                    <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="M18 6 6 18" />
                                        <path d="m6 6 12 12" />
                                    </svg>
                                </x-ui.button>
                            </div>
                        </x-slot:actions>
                    </x-ui.product-card>
                </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.1.2
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0