Skip to content
Brok UI

Loading…

No results

Dashboard

Open + Pro variants

Full dashboard screens — KPI stats, charts, tables and activity feeds across finance, commerce, support, analytics and observability.

5 of 12

Preview

resources/views/pages/dashboard-commerce.blade.php Blade
@props([
    'title' => 'Commerce overview',
    'subtitle' => 'Revenue trends, refund health, and where sales come from.',
    'stats' => null,
    'series' => null,
    'categories' => null,
    'categoryShare' => null,
    'categoryLabels' => null,
    'actions' => null,
])

@php
    $stats ??= [
        ['label' => 'Gross sales', 'value' => '$214,800', 'delta' => '+11.3%', 'description' => 'vs last month'],
        ['label' => 'Orders', 'value' => '6,184', 'delta' => '+5.6%', 'description' => 'vs last month'],
        ['label' => 'Refund rate', 'value' => '2.1%', 'delta' => '-0.5%', 'description' => 'of orders'],
        ['label' => 'Avg. order value', 'value' => '$34.74', 'delta' => '+2.2%', 'description' => 'per order'],
    ];

    $series ??= [
        ['name' => __('Revenue'), 'data' => [12400, 14800, 13900, 16200, 18800, 17600, 21400, 23800, 22600, 26200, 28800, 31400]],
    ];

    $categories ??= [
        __('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'),
        __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec'),
    ];

    // Donut chart: flat series + matching labels (see dashboard-overview chart contract).
    $categoryShare ??= [42, 26, 18, 14];
    $categoryLabels ??= [__('Apparel'), __('Footwear'), __('Accessories'), __('Home')];

    $actions ??= [
        ['title' => 'Restock 8 low-inventory SKUs', 'meta' => 'Inventory falling below threshold', 'badge' => 'Urgent', 'tone' => 'destructive'],
        ['title' => 'Review 12 flagged refunds', 'meta' => 'Awaiting manual approval', 'badge' => 'Action', 'tone' => 'warning'],
        ['title' => 'Publish summer collection', 'meta' => '24 products staged', 'badge' => 'Draft', 'tone' => 'secondary'],
        ['title' => 'Reply to 5 product questions', 'meta' => 'Posted in the last 24h', 'badge' => 'New', 'tone' => 'default'],
        ['title' => 'Renew expiring promo codes', 'meta' => '3 expire this week', 'badge' => 'Soon', 'tone' => 'outline'],
    ];

    // ApexCharts needs concrete colours; reference the semantic tokens via their CSS
    // variables so the chart still tracks the active theme (this is chart config, not markup).
    $trendOptions = [
        'colors' => ['var(--chart-1-color, hsl(var(--chart-1)))'],
        'chart' => [
            'toolbar' => ['show' => false],
            'zoom' => ['enabled' => false],
            'fontFamily' => 'inherit',
        ],
        'stroke' => ['curve' => 'smooth', 'width' => 2],
        'dataLabels' => ['enabled' => false],
        'fill' => [
            'type' => 'gradient',
            'gradient' => ['shadeIntensity' => 1, 'opacityFrom' => 0.4, 'opacityTo' => 0.05, 'stops' => [0, 90, 100]],
        ],
        'grid' => ['borderColor' => 'var(--border-color, hsl(var(--border)))', 'strokeDashArray' => 4],
        'legend' => ['show' => false],
        'xaxis' => [
            'categories' => $categories,
            'axisBorder' => ['show' => false],
            'axisTicks' => ['show' => false],
            'labels' => ['style' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']],
        ],
        'yaxis' => ['labels' => ['style' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']]],
    ];

    $donutOptions = [
        'colors' => ['var(--chart-1-color, hsl(var(--chart-1)))', 'var(--chart-2-color, hsl(var(--chart-2)))', 'var(--chart-3-color, hsl(var(--chart-3)))', 'var(--chart-4-color, hsl(var(--chart-4)))'],
        'labels' => $categoryLabels,
        'chart' => ['fontFamily' => 'inherit'],
        'stroke' => ['width' => 0],
        'dataLabels' => ['enabled' => false],
        'legend' => ['show' => true, 'position' => 'bottom', 'labels' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']],
        'plotOptions' => ['pie' => ['donut' => ['size' => '68%']]],
    ];
@endphp

<section data-surface="admin" {{ $attributes->merge(['class' => 'min-h-svh bg-background p-4 text-foreground sm:p-6 lg:p-8']) }}>
    <div class="mx-auto max-w-7xl space-y-6">
        {{-- Header --}}
        <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
            <div>
                <h1 class="text-2xl font-bold tracking-tight">{{ __($title) }}</h1>
                <p class="mt-2 text-muted-foreground">{{ __($subtitle) }}</p>
            </div>
            <div class="flex shrink-0 gap-2">
                <x-ui.button variant="outline" size="sm" class="whitespace-nowrap">{{ __('This year') }}</x-ui.button>
                <x-ui.button size="sm" class="whitespace-nowrap">{{ __('Add product') }}</x-ui.button>
            </div>
        </div>

        {{-- Commerce KPI row --}}
        <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
            @foreach ($stats as $stat)
                <x-ui.stat
                    :label="__($stat['label'])"
                    :value="$stat['value']"
                    :delta="$stat['delta']"
                    :description="__($stat['description'])"
                />
            @endforeach
        </div>

        {{-- Revenue trend (wide) + category-ranking donut --}}
        <div class="grid gap-6 lg:grid-cols-[2fr_1fr]">
            <x-ui.card>
                <x-ui.card.header>
                    <div class="flex items-center justify-between gap-4">
                        <div class="space-y-2">
                            <x-ui.card.title>{{ __('Revenue trend') }}</x-ui.card.title>
                            <x-ui.card.description>{{ __('Net revenue over the last twelve months.') }}</x-ui.card.description>
                        </div>
                        <x-ui.badge variant="success" class="whitespace-nowrap">{{ __('+11.3%') }}</x-ui.badge>
                    </div>
                </x-ui.card.header>
                <x-ui.card.content>
                    <x-ui.chart type="area" :series="$series" :options="$trendOptions" :height="300" :label="__('Revenue trend area chart')" />
                </x-ui.card.content>
            </x-ui.card>

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Category ranking') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('Share of revenue by product category.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content>
                    <x-ui.chart type="donut" :series="$categoryShare" :options="$donutOptions" :height="300" :label="__('Category revenue donut chart')" />
                </x-ui.card.content>
            </x-ui.card>
        </div>

        {{-- Quick actions --}}
        <x-ui.card>
            <x-ui.card.header>
                <div class="flex items-center justify-between gap-4">
                    <div class="space-y-2">
                        <x-ui.card.title>{{ __('Quick actions') }}</x-ui.card.title>
                        <x-ui.card.description>{{ __('Tasks that need your attention today.') }}</x-ui.card.description>
                    </div>
                    <x-ui.button variant="outline" size="sm" class="whitespace-nowrap">{{ __('View tasks') }}</x-ui.button>
                </div>
            </x-ui.card.header>
            <x-ui.card.content>
                <x-ui.item.group>
                    @foreach ($actions as $action)
                        @unless ($loop->first)
                            <x-ui.separator />
                        @endunless
                        <x-ui.item size="sm" class="px-0 first:pt-0 last:pb-0">
                            <x-ui.item.content class="min-w-0">
                                <x-ui.item.title><span class="truncate">{{ __($action['title']) }}</span></x-ui.item.title>
                                <x-ui.item.description class="truncate text-xs">{{ __($action['meta']) }}</x-ui.item.description>
                            </x-ui.item.content>
                            <x-ui.item.actions>
                                <x-ui.badge :variant="$action['tone']" class="whitespace-nowrap">{{ __($action['badge']) }}</x-ui.badge>
                                <x-ui.button variant="ghost" size="sm" class="shrink-0" :aria-label="__('Open task')">
                                    <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
                                </x-ui.button>
                            </x-ui.item.actions>
                        </x-ui.item>
                    @endforeach
                </x-ui.item.group>
            </x-ui.card.content>
        </x-ui.card>
    </div>
</section>

Installation

terminal
php artisan ui:add pages/dashboard-commerce

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

stat card chart button badge item separator

Package dependencies

composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: what the page is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this page in an assistant.

dashboard-commerce.md
# Brok UI page: Dashboard 04 (`dashboard-commerce`)

A commerce dashboard: gross-sales and refund-rate KPI stats, a revenue-trend area chart, a category-ranking donut chart, and a quick-actions list with priority badges.

Brok UI is a Laravel Blade registry. `ui:add` copies this page into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.

## Install

```bash
php artisan ui:add pages/dashboard-commerce
```

## Render it

```blade
<x-pages.dashboard-commerce />
```

## Props

- `title` (string, default `Commerce overview`) — Section heading.
- `subtitle` (string, default `Revenue trends, refund health, and where sales come from.`) — Supporting copy under the heading.
- `stats` (mixed|null, default `null`) — KPI stat cards ({label, value, delta, description}); null falls back to sample data.
- `series` (mixed|null, default `null`) — Revenue-trend area-chart series; null falls back to sample data.
- `categories` (mixed|null, default `null`) — X-axis month labels for the revenue chart; null falls back to sample data.
- `category-share` (mixed|null, default `null`) — Donut-chart slice values; null falls back to sample data.
- `category-labels` (mixed|null, default `null`) — Donut-chart slice labels; null falls back to sample data.
- `actions` (mixed|null, default `null`) — Quick-actions list entries with a priority badge; null falls back to sample data.

## Use when

- A commerce admin dashboard: gross-sales and refund-rate KPI stats, a revenue-trend area chart, a category-ranking donut chart and a quick-actions list.
- It composes primitives directly (stat, card, chart, button, badge, item, separator) rather than marketing blocks.

## Avoid when

- Needing a finance, support or web-analytics dashboard instead of commerce; use dashboard-dense-kpi, dashboard-support or dashboard-analytics instead.

## Rules

- Render the installed page with `<x-pages.dashboard-commerce />` 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/pages/dashboard-commerce
- Registry JSON (files, props, contract): https://brokui.dev/r/open/pages/dashboard-commerce.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

  • A commerce admin dashboard: gross-sales and refund-rate KPI stats, a revenue-trend area chart, a category-ranking donut chart and a quick-actions list.
  • It composes primitives directly (stat, card, chart, button, badge, item, separator) rather than marketing blocks.

Avoid when

  • Needing a finance, support or web-analytics dashboard instead of commerce; use dashboard-dense-kpi, dashboard-support or dashboard-analytics instead.

Anti-patterns

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

Usage

Render the page as a component, or wire it to a route. Pass data where useful:

resources/views/welcome.blade.php Blade
<x-pages.dashboard-commerce />

Built from blocks & primitives

This page 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 pages.

resources/views/pages/dashboard-commerce.blade.php Blade
@props([
    'title' => 'Commerce overview',
    'subtitle' => 'Revenue trends, refund health, and where sales come from.',
    'stats' => null,
    'series' => null,
    'categories' => null,
    'categoryShare' => null,
    'categoryLabels' => null,
    'actions' => null,
])

@php
    $stats ??= [
        ['label' => 'Gross sales', 'value' => '$214,800', 'delta' => '+11.3%', 'description' => 'vs last month'],
        ['label' => 'Orders', 'value' => '6,184', 'delta' => '+5.6%', 'description' => 'vs last month'],
        ['label' => 'Refund rate', 'value' => '2.1%', 'delta' => '-0.5%', 'description' => 'of orders'],
        ['label' => 'Avg. order value', 'value' => '$34.74', 'delta' => '+2.2%', 'description' => 'per order'],
    ];

    $series ??= [
        ['name' => __('Revenue'), 'data' => [12400, 14800, 13900, 16200, 18800, 17600, 21400, 23800, 22600, 26200, 28800, 31400]],
    ];

    $categories ??= [
        __('Jan'), __('Feb'), __('Mar'), __('Apr'), __('May'), __('Jun'),
        __('Jul'), __('Aug'), __('Sep'), __('Oct'), __('Nov'), __('Dec'),
    ];

    // Donut chart: flat series + matching labels (see dashboard-overview chart contract).
    $categoryShare ??= [42, 26, 18, 14];
    $categoryLabels ??= [__('Apparel'), __('Footwear'), __('Accessories'), __('Home')];

    $actions ??= [
        ['title' => 'Restock 8 low-inventory SKUs', 'meta' => 'Inventory falling below threshold', 'badge' => 'Urgent', 'tone' => 'destructive'],
        ['title' => 'Review 12 flagged refunds', 'meta' => 'Awaiting manual approval', 'badge' => 'Action', 'tone' => 'warning'],
        ['title' => 'Publish summer collection', 'meta' => '24 products staged', 'badge' => 'Draft', 'tone' => 'secondary'],
        ['title' => 'Reply to 5 product questions', 'meta' => 'Posted in the last 24h', 'badge' => 'New', 'tone' => 'default'],
        ['title' => 'Renew expiring promo codes', 'meta' => '3 expire this week', 'badge' => 'Soon', 'tone' => 'outline'],
    ];

    // ApexCharts needs concrete colours; reference the semantic tokens via their CSS
    // variables so the chart still tracks the active theme (this is chart config, not markup).
    $trendOptions = [
        'colors' => ['var(--chart-1-color, hsl(var(--chart-1)))'],
        'chart' => [
            'toolbar' => ['show' => false],
            'zoom' => ['enabled' => false],
            'fontFamily' => 'inherit',
        ],
        'stroke' => ['curve' => 'smooth', 'width' => 2],
        'dataLabels' => ['enabled' => false],
        'fill' => [
            'type' => 'gradient',
            'gradient' => ['shadeIntensity' => 1, 'opacityFrom' => 0.4, 'opacityTo' => 0.05, 'stops' => [0, 90, 100]],
        ],
        'grid' => ['borderColor' => 'var(--border-color, hsl(var(--border)))', 'strokeDashArray' => 4],
        'legend' => ['show' => false],
        'xaxis' => [
            'categories' => $categories,
            'axisBorder' => ['show' => false],
            'axisTicks' => ['show' => false],
            'labels' => ['style' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']],
        ],
        'yaxis' => ['labels' => ['style' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']]],
    ];

    $donutOptions = [
        'colors' => ['var(--chart-1-color, hsl(var(--chart-1)))', 'var(--chart-2-color, hsl(var(--chart-2)))', 'var(--chart-3-color, hsl(var(--chart-3)))', 'var(--chart-4-color, hsl(var(--chart-4)))'],
        'labels' => $categoryLabels,
        'chart' => ['fontFamily' => 'inherit'],
        'stroke' => ['width' => 0],
        'dataLabels' => ['enabled' => false],
        'legend' => ['show' => true, 'position' => 'bottom', 'labels' => ['colors' => 'var(--muted-foreground-color, hsl(var(--muted-foreground)))']],
        'plotOptions' => ['pie' => ['donut' => ['size' => '68%']]],
    ];
@endphp

<section data-surface="admin" {{ $attributes->merge(['class' => 'min-h-svh bg-background p-4 text-foreground sm:p-6 lg:p-8']) }}>
    <div class="mx-auto max-w-7xl space-y-6">
        {{-- Header --}}
        <div class="flex flex-col justify-between gap-4 sm:flex-row sm:items-center">
            <div>
                <h1 class="text-2xl font-bold tracking-tight">{{ __($title) }}</h1>
                <p class="mt-2 text-muted-foreground">{{ __($subtitle) }}</p>
            </div>
            <div class="flex shrink-0 gap-2">
                <x-ui.button variant="outline" size="sm" class="whitespace-nowrap">{{ __('This year') }}</x-ui.button>
                <x-ui.button size="sm" class="whitespace-nowrap">{{ __('Add product') }}</x-ui.button>
            </div>
        </div>

        {{-- Commerce KPI row --}}
        <div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
            @foreach ($stats as $stat)
                <x-ui.stat
                    :label="__($stat['label'])"
                    :value="$stat['value']"
                    :delta="$stat['delta']"
                    :description="__($stat['description'])"
                />
            @endforeach
        </div>

        {{-- Revenue trend (wide) + category-ranking donut --}}
        <div class="grid gap-6 lg:grid-cols-[2fr_1fr]">
            <x-ui.card>
                <x-ui.card.header>
                    <div class="flex items-center justify-between gap-4">
                        <div class="space-y-2">
                            <x-ui.card.title>{{ __('Revenue trend') }}</x-ui.card.title>
                            <x-ui.card.description>{{ __('Net revenue over the last twelve months.') }}</x-ui.card.description>
                        </div>
                        <x-ui.badge variant="success" class="whitespace-nowrap">{{ __('+11.3%') }}</x-ui.badge>
                    </div>
                </x-ui.card.header>
                <x-ui.card.content>
                    <x-ui.chart type="area" :series="$series" :options="$trendOptions" :height="300" :label="__('Revenue trend area chart')" />
                </x-ui.card.content>
            </x-ui.card>

            <x-ui.card>
                <x-ui.card.header>
                    <x-ui.card.title>{{ __('Category ranking') }}</x-ui.card.title>
                    <x-ui.card.description>{{ __('Share of revenue by product category.') }}</x-ui.card.description>
                </x-ui.card.header>
                <x-ui.card.content>
                    <x-ui.chart type="donut" :series="$categoryShare" :options="$donutOptions" :height="300" :label="__('Category revenue donut chart')" />
                </x-ui.card.content>
            </x-ui.card>
        </div>

        {{-- Quick actions --}}
        <x-ui.card>
            <x-ui.card.header>
                <div class="flex items-center justify-between gap-4">
                    <div class="space-y-2">
                        <x-ui.card.title>{{ __('Quick actions') }}</x-ui.card.title>
                        <x-ui.card.description>{{ __('Tasks that need your attention today.') }}</x-ui.card.description>
                    </div>
                    <x-ui.button variant="outline" size="sm" class="whitespace-nowrap">{{ __('View tasks') }}</x-ui.button>
                </div>
            </x-ui.card.header>
            <x-ui.card.content>
                <x-ui.item.group>
                    @foreach ($actions as $action)
                        @unless ($loop->first)
                            <x-ui.separator />
                        @endunless
                        <x-ui.item size="sm" class="px-0 first:pt-0 last:pb-0">
                            <x-ui.item.content class="min-w-0">
                                <x-ui.item.title><span class="truncate">{{ __($action['title']) }}</span></x-ui.item.title>
                                <x-ui.item.description class="truncate text-xs">{{ __($action['meta']) }}</x-ui.item.description>
                            </x-ui.item.content>
                            <x-ui.item.actions>
                                <x-ui.badge :variant="$action['tone']" class="whitespace-nowrap">{{ __($action['badge']) }}</x-ui.badge>
                                <x-ui.button variant="ghost" size="sm" class="shrink-0" :aria-label="__('Open task')">
                                    <svg class="size-4 rtl:-scale-x-100" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg>
                                </x-ui.button>
                            </x-ui.item.actions>
                        </x-ui.item>
                    @endforeach
                </x-ui.item.group>
            </x-ui.card.content>
        </x-ui.card>
    </div>
</section>

Ownership & lifecycle

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