Skip to content
Brok UI

Loading…

No results

Data Tables

Open source

Pre-composed business data tables — recent transactions, CRM deal pipeline and LMS course progress.

Preview

resources/views/blocks/data-tables-transactions.blade.php Blade
@props([
    'title'        => null,
    'transactions' => null,
])

@php
    $title ??= __('Recent transactions');

    $transactions ??= [
        [
            'id'       => 'TXN-0091',
            'merchant' => 'Spotify',
            'initials' => 'SP',
            'category' => 'Subscriptions',
            'date'     => 'Jun 14, 2026',
            'amount'   => '-$9.99',
            'positive' => false,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0090',
            'merchant' => 'Acme Corp',
            'initials' => 'AC',
            'category' => 'Income',
            'date'     => 'Jun 13, 2026',
            'amount'   => '+$3,200.00',
            'positive' => true,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0089',
            'merchant' => 'Netflix',
            'initials' => 'NF',
            'category' => 'Subscriptions',
            'date'     => 'Jun 12, 2026',
            'amount'   => '-$15.49',
            'positive' => false,
            'status'   => 'Pending',
        ],
        [
            'id'       => 'TXN-0088',
            'merchant' => 'AWS',
            'initials' => 'AW',
            'category' => 'Infrastructure',
            'date'     => 'Jun 11, 2026',
            'amount'   => '-$142.30',
            'positive' => false,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0087',
            'merchant' => 'Freelance Hub',
            'initials' => 'FH',
            'category' => 'Income',
            'date'     => 'Jun 10, 2026',
            'amount'   => '+$850.00',
            'positive' => true,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0086',
            'merchant' => 'Figma',
            'initials' => 'FG',
            'category' => 'Design Tools',
            'date'     => 'Jun 9, 2026',
            'amount'   => '-$45.00',
            'positive' => false,
            'status'   => 'Failed',
        ],
        [
            'id'       => 'TXN-0085',
            'merchant' => 'Refund — Shopify',
            'initials' => 'SH',
            'category' => 'Refund',
            'date'     => 'Jun 8, 2026',
            'amount'   => '+$29.00',
            'positive' => true,
            'status'   => 'Pending',
        ],
    ];

    $statusVariant = [
        'Completed' => 'success',
        'Pending'   => 'secondary',
        'Failed'    => 'destructive',
    ];

    $filters = [
        ['label' => __('All'),      'value' => 'all'],
        ['label' => __('Income'),   'value' => 'income'],
        ['label' => __('Expenses'), 'value' => 'expenses'],
    ];
@endphp

<x-ui.section space="xl" {{ $attributes }}>
    <div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">

        {{-- Card wrapper --}}
        <x-ui.card>

            {{-- Card header --}}
            <div class="flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-4">
                <h2 class="text-base font-semibold">{{ $title }}</h2>

                <div class="flex flex-wrap items-center gap-2">
                    {{-- Filter chips --}}
                    @foreach ($filters as $filter)
                        <x-ui.button
                            type="button"
                            variant="outline"
                            size="sm"
                            aria-label="{{ __('Filter by') }} {{ $filter['label'] }}"
                        >
                            {{ $filter['label'] }}
                        </x-ui.button>
                    @endforeach

                    {{-- Export button --}}
                    <x-ui.button
                        type="button"
                        variant="outline"
                        size="sm"
                    >
                        {{-- Download icon --}}
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4" aria-hidden="true">
                            <path d="M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z" />
                            <path d="M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z" />
                        </svg>
                        {{ __('Export') }}
                    </x-ui.button>
                </div>
            </div>

            {{-- Table --}}
            <div class="overflow-x-auto">
                <x-ui.table>
                    <x-ui.table.header>
                        <x-ui.table.row>
                            <x-ui.table.head scope="col">{{ __('Transaction') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Category') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Date') }}</x-ui.table.head>
                            <x-ui.table.head scope="col" class="text-end">{{ __('Amount') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Status') }}</x-ui.table.head>
                        </x-ui.table.row>
                    </x-ui.table.header>
                    <x-ui.table.body>
                        @foreach ($transactions as $tx)
                            <x-ui.table.row>
                                {{-- Merchant cell --}}
                                <x-ui.table.cell>
                                    <div class="flex items-center gap-4">
                                        <x-ui.avatar
                                            :fallback="$tx['initials']"
                                            size="sm"
                                            class="shrink-0"
                                            :alt="$tx['merchant']"
                                        />
                                        <div class="min-w-0">
                                            <p class="truncate text-sm font-medium">{{ $tx['merchant'] }}</p>
                                            <p class="text-xs text-muted-foreground tabular-nums">#{{ $tx['id'] }}</p>
                                        </div>
                                    </div>
                                </x-ui.table.cell>

                                {{-- Category --}}
                                <x-ui.table.cell>
                                    <x-ui.badge variant="secondary">{{ __($tx['category']) }}</x-ui.badge>
                                </x-ui.table.cell>

                                {{-- Date --}}
                                <x-ui.table.cell class="text-sm text-muted-foreground whitespace-nowrap">
                                    {{ $tx['date'] }}
                                </x-ui.table.cell>

                                {{-- Amount --}}
                                <x-ui.table.cell class="text-end">
                                    <span @class([
                                        'tabular-nums text-sm font-medium',
                                        'text-primary' => $tx['positive'],
                                        'text-foreground' => ! $tx['positive'],
                                    ])>
                                        {{ $tx['amount'] }}
                                    </span>
                                </x-ui.table.cell>

                                {{-- Status --}}
                                <x-ui.table.cell>
                                    <x-ui.badge :variant="$statusVariant[$tx['status']] ?? 'secondary'">
                                        {{ __($tx['status']) }}
                                    </x-ui.badge>
                                </x-ui.table.cell>
                            </x-ui.table.row>
                        @endforeach
                    </x-ui.table.body>
                </x-ui.table>
            </div>

        </x-ui.card>
    </div>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/data-tables-transactions

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

avatar badge button card section table

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.

data-tables-transactions.md
# Brok UI block: Transactions Table (`data-tables-transactions`)

Recent-transactions finance table with filter chips, Export button, merchant avatar, category badge, signed amount, and Completed/Pending/Failed status badges.

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/data-tables-transactions
```

## Render it

```blade
<x-blocks.data-tables-transactions />
```

## Use when

- Showing recent financial activity with merchant, category, amount, and status context.

## Avoid when

- Users need sorting, pagination, or row selection; start with data-table instead.

## Rules

- Render the installed block with `<x-blocks.data-tables-transactions />` 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/data-tables-transactions
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/data-tables-transactions.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 recent financial activity with merchant, category, amount, and status context.

Avoid when

  • Users need sorting, pagination, or row selection; start with data-table instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.

Usage

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

resources/views/welcome.blade.php Blade
<x-blocks.data-tables-transactions />

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/data-tables-transactions.blade.php Blade
@props([
    'title'        => null,
    'transactions' => null,
])

@php
    $title ??= __('Recent transactions');

    $transactions ??= [
        [
            'id'       => 'TXN-0091',
            'merchant' => 'Spotify',
            'initials' => 'SP',
            'category' => 'Subscriptions',
            'date'     => 'Jun 14, 2026',
            'amount'   => '-$9.99',
            'positive' => false,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0090',
            'merchant' => 'Acme Corp',
            'initials' => 'AC',
            'category' => 'Income',
            'date'     => 'Jun 13, 2026',
            'amount'   => '+$3,200.00',
            'positive' => true,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0089',
            'merchant' => 'Netflix',
            'initials' => 'NF',
            'category' => 'Subscriptions',
            'date'     => 'Jun 12, 2026',
            'amount'   => '-$15.49',
            'positive' => false,
            'status'   => 'Pending',
        ],
        [
            'id'       => 'TXN-0088',
            'merchant' => 'AWS',
            'initials' => 'AW',
            'category' => 'Infrastructure',
            'date'     => 'Jun 11, 2026',
            'amount'   => '-$142.30',
            'positive' => false,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0087',
            'merchant' => 'Freelance Hub',
            'initials' => 'FH',
            'category' => 'Income',
            'date'     => 'Jun 10, 2026',
            'amount'   => '+$850.00',
            'positive' => true,
            'status'   => 'Completed',
        ],
        [
            'id'       => 'TXN-0086',
            'merchant' => 'Figma',
            'initials' => 'FG',
            'category' => 'Design Tools',
            'date'     => 'Jun 9, 2026',
            'amount'   => '-$45.00',
            'positive' => false,
            'status'   => 'Failed',
        ],
        [
            'id'       => 'TXN-0085',
            'merchant' => 'Refund — Shopify',
            'initials' => 'SH',
            'category' => 'Refund',
            'date'     => 'Jun 8, 2026',
            'amount'   => '+$29.00',
            'positive' => true,
            'status'   => 'Pending',
        ],
    ];

    $statusVariant = [
        'Completed' => 'success',
        'Pending'   => 'secondary',
        'Failed'    => 'destructive',
    ];

    $filters = [
        ['label' => __('All'),      'value' => 'all'],
        ['label' => __('Income'),   'value' => 'income'],
        ['label' => __('Expenses'), 'value' => 'expenses'],
    ];
@endphp

<x-ui.section space="xl" {{ $attributes }}>
    <div class="mx-auto max-w-6xl px-4 sm:px-6 lg:px-8">

        {{-- Card wrapper --}}
        <x-ui.card>

            {{-- Card header --}}
            <div class="flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-4">
                <h2 class="text-base font-semibold">{{ $title }}</h2>

                <div class="flex flex-wrap items-center gap-2">
                    {{-- Filter chips --}}
                    @foreach ($filters as $filter)
                        <x-ui.button
                            type="button"
                            variant="outline"
                            size="sm"
                            aria-label="{{ __('Filter by') }} {{ $filter['label'] }}"
                        >
                            {{ $filter['label'] }}
                        </x-ui.button>
                    @endforeach

                    {{-- Export button --}}
                    <x-ui.button
                        type="button"
                        variant="outline"
                        size="sm"
                    >
                        {{-- Download icon --}}
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4" aria-hidden="true">
                            <path d="M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z" />
                            <path d="M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z" />
                        </svg>
                        {{ __('Export') }}
                    </x-ui.button>
                </div>
            </div>

            {{-- Table --}}
            <div class="overflow-x-auto">
                <x-ui.table>
                    <x-ui.table.header>
                        <x-ui.table.row>
                            <x-ui.table.head scope="col">{{ __('Transaction') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Category') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Date') }}</x-ui.table.head>
                            <x-ui.table.head scope="col" class="text-end">{{ __('Amount') }}</x-ui.table.head>
                            <x-ui.table.head scope="col">{{ __('Status') }}</x-ui.table.head>
                        </x-ui.table.row>
                    </x-ui.table.header>
                    <x-ui.table.body>
                        @foreach ($transactions as $tx)
                            <x-ui.table.row>
                                {{-- Merchant cell --}}
                                <x-ui.table.cell>
                                    <div class="flex items-center gap-4">
                                        <x-ui.avatar
                                            :fallback="$tx['initials']"
                                            size="sm"
                                            class="shrink-0"
                                            :alt="$tx['merchant']"
                                        />
                                        <div class="min-w-0">
                                            <p class="truncate text-sm font-medium">{{ $tx['merchant'] }}</p>
                                            <p class="text-xs text-muted-foreground tabular-nums">#{{ $tx['id'] }}</p>
                                        </div>
                                    </div>
                                </x-ui.table.cell>

                                {{-- Category --}}
                                <x-ui.table.cell>
                                    <x-ui.badge variant="secondary">{{ __($tx['category']) }}</x-ui.badge>
                                </x-ui.table.cell>

                                {{-- Date --}}
                                <x-ui.table.cell class="text-sm text-muted-foreground whitespace-nowrap">
                                    {{ $tx['date'] }}
                                </x-ui.table.cell>

                                {{-- Amount --}}
                                <x-ui.table.cell class="text-end">
                                    <span @class([
                                        'tabular-nums text-sm font-medium',
                                        'text-primary' => $tx['positive'],
                                        'text-foreground' => ! $tx['positive'],
                                    ])>
                                        {{ $tx['amount'] }}
                                    </span>
                                </x-ui.table.cell>

                                {{-- Status --}}
                                <x-ui.table.cell>
                                    <x-ui.badge :variant="$statusVariant[$tx['status']] ?? 'secondary'">
                                        {{ __($tx['status']) }}
                                    </x-ui.badge>
                                </x-ui.table.cell>
                            </x-ui.table.row>
                        @endforeach
                    </x-ui.table.body>
                </x-ui.table>
            </div>

        </x-ui.card>
    </div>
</x-ui.section>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.1.6
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0