Skip to content
Brok UI

Loading…

No results

Stats

Open source

Metric sections — a centered grid of headline numbers and a split layout pairing copy with trend cards.

Preview

resources/views/blocks/stats-grid.blade.php Blade
@props([
    'eyebrow'    => 'By the numbers',
    'heading'    => 'Trusted by teams around the world',
    'subheading' => 'We\'ve helped thousands of businesses grow faster, ship smarter, and delight their customers at every step.',
    'stats'      => null,
])

@php
    $stats ??= [
        ['metric' => '99.9%', 'label' => 'Uptime SLA', 'sub' => 'Across all regions, every month', 'trend' => null],
        ['metric' => '12k+', 'label' => 'Active teams', 'sub' => 'From startups to Fortune 500', 'trend' => '+12%'],
        ['metric' => '4.9/5', 'label' => 'Customer rating', 'sub' => 'Based on 3,200+ reviews', 'trend' => '+0.2'],
        ['metric' => '24/7', 'label' => 'Expert support', 'sub' => 'Median first-response under 4 min', 'trend' => null],
    ];
@endphp

<x-ui.section space="xl" {{ $attributes }}>
    <x-ui.container gutter="sm">
        <x-ui.section-heading align="center" overline-style="label" :overline="$eyebrow" :title="$heading" :subtitle="$subheading" />

        <div class="mt-12 grid grid-cols-2 gap-4 lg:grid-cols-4">
            @foreach ($stats as $stat)
                <x-ui.stat
                    size="lg"
                    :value="$stat['metric']"
                    :label="__($stat['label'])"
                    :delta="$stat['trend'] ?? null"
                    :description="! empty($stat['sub']) ? __($stat['sub']) : null"
                    class="items-center text-center"
                />
            @endforeach
        </div>
    </x-ui.container>
</x-ui.section>

Installation

terminal
php artisan ui:add blocks/stats-grid

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

container section section-heading stat

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.

stats-grid.md
# Brok UI block: Stats (`stats-grid`)

A centered intro above a responsive grid of headline metric cards, each with a large number, label, supporting line and an optional trend badge, marked up as a description list.

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

## Render it

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

## Props

- `eyebrow` (string, default `By the numbers`) — Small label shown above the heading.
- `heading` (string, default `Trusted by teams around the world`) — Section heading.
- `subheading` (string, default `We\'ve helped thousands of businesses grow faster, ship smarter, and delight their customers at every step.`) — Supporting copy under the heading.
- `stats` (mixed|null, default `null`) — Metric cards with a value, label, supporting line and optional trend; null falls back to sample data.

## Use when

- Presenting a centered intro above a grid of headline metric cards, each with a big number and supporting line.
- Wanting metrics to be the whole section rather than paired with other copy.

## Avoid when

- Pairing stats with a lead paragraph and a call to action beside them; use stats-split instead. Wanting a bold filled-panel treatment; use stats-band instead.

## Rules

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

  • Presenting a centered intro above a grid of headline metric cards, each with a big number and supporting line.
  • Wanting metrics to be the whole section rather than paired with other copy.

Avoid when

  • Pairing stats with a lead paragraph and a call to action beside them; use stats-split instead. Wanting a bold filled-panel treatment; use stats-band 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.stats-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/stats-grid.blade.php Blade
@props([
    'eyebrow'    => 'By the numbers',
    'heading'    => 'Trusted by teams around the world',
    'subheading' => 'We\'ve helped thousands of businesses grow faster, ship smarter, and delight their customers at every step.',
    'stats'      => null,
])

@php
    $stats ??= [
        ['metric' => '99.9%', 'label' => 'Uptime SLA', 'sub' => 'Across all regions, every month', 'trend' => null],
        ['metric' => '12k+', 'label' => 'Active teams', 'sub' => 'From startups to Fortune 500', 'trend' => '+12%'],
        ['metric' => '4.9/5', 'label' => 'Customer rating', 'sub' => 'Based on 3,200+ reviews', 'trend' => '+0.2'],
        ['metric' => '24/7', 'label' => 'Expert support', 'sub' => 'Median first-response under 4 min', 'trend' => null],
    ];
@endphp

<x-ui.section space="xl" {{ $attributes }}>
    <x-ui.container gutter="sm">
        <x-ui.section-heading align="center" overline-style="label" :overline="$eyebrow" :title="$heading" :subtitle="$subheading" />

        <div class="mt-12 grid grid-cols-2 gap-4 lg:grid-cols-4">
            @foreach ($stats as $stat)
                <x-ui.stat
                    size="lg"
                    :value="$stat['metric']"
                    :label="__($stat['label'])"
                    :delta="$stat['trend'] ?? null"
                    :description="! empty($stat['sub']) ? __($stat['sub']) : null"
                    class="items-center text-center"
                />
            @endforeach
        </div>
    </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.0.5
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0