Skip to content
Brok UI

Loading…

No results

Sports Widget

Open source

Live and final sports cards — football scoreboard, live match, fixtures list, cricket scorecard and commentary, and a basketball period breakdown.

Preview

3 of 6

resources/views/blocks/sports-widget-fixtures.blade.php Blade
@props([
    'heading' => 'Fixtures',
    'matches' => null,
])

@php
    $matches ??= [
        ['home' => 'FCB', 'homeName' => 'FC Barcelona', 'away' => 'BVB', 'awayName' => 'Borussia Dortmund', 'date' => '25 Oct', 'time' => '8:30 PM'],
        ['home' => 'MCI', 'homeName' => 'Manchester City', 'away' => 'FCB', 'awayName' => 'FC Barcelona', 'date' => '29 Oct', 'time' => '12:30 PM'],
        ['home' => 'BVB', 'homeName' => 'Borussia Dortmund', 'away' => 'FCB', 'awayName' => 'FC Barcelona', 'date' => '31 Oct', 'time' => '8:30 PM'],
    ];
@endphp

<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-4']) }}>
    <div class="text-sm text-muted-foreground">{{ __($heading) }}</div>

    <div class="flex flex-1 flex-col items-center gap-2">
        @foreach ($matches as $match)
            <div class="flex w-full items-center justify-between gap-2 rounded-md bg-secondary px-2 py-2">
                <x-ui.avatar :fallback="$match['home']" :alt="$match['homeName']" size="sm" class="size-7" />
                <div class="flex flex-col items-center text-xs text-muted-foreground">
                    <span>{{ $match['date'] }}</span>
                    <span>{{ $match['time'] }}</span>
                </div>
                <x-ui.avatar :fallback="$match['away']" :alt="$match['awayName']" size="sm" class="size-7" />
            </div>
        @endforeach
    </div>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/sports-widget-fixtures

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

card avatar

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.

sports-widget-fixtures.md
# Brok UI block: Sports Widget Fixtures (`sports-widget-fixtures`)

Upcoming fixtures widget listing home and away teams with the date and time of each match.

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/sports-widget-fixtures
```

## Render it

```blade
<x-blocks.sports-widget-fixtures />
```

## Props

- `heading` (string, default `Fixtures`) — Section heading.
- `matches` (mixed|null, default `null`) — Fixture rows with home/away abbreviations, names, date and time; null falls back to sample data.

## Use when

- Listing several upcoming football fixtures with home and away teams, date and time.
- Wanting the widget's purpose to be a schedule rather than a single match's score.

## Avoid when

- Showing a single match's live or final score; use sports-widget-scoreboard or sports-widget-live instead.

## Rules

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

  • Listing several upcoming football fixtures with home and away teams, date and time.
  • Wanting the widget's purpose to be a schedule rather than a single match's score.

Avoid when

  • Showing a single match's live or final score; use sports-widget-scoreboard or sports-widget-live 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.sports-widget-fixtures />

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/sports-widget-fixtures.blade.php Blade
@props([
    'heading' => 'Fixtures',
    'matches' => null,
])

@php
    $matches ??= [
        ['home' => 'FCB', 'homeName' => 'FC Barcelona', 'away' => 'BVB', 'awayName' => 'Borussia Dortmund', 'date' => '25 Oct', 'time' => '8:30 PM'],
        ['home' => 'MCI', 'homeName' => 'Manchester City', 'away' => 'FCB', 'awayName' => 'FC Barcelona', 'date' => '29 Oct', 'time' => '12:30 PM'],
        ['home' => 'BVB', 'homeName' => 'Borussia Dortmund', 'away' => 'FCB', 'awayName' => 'FC Barcelona', 'date' => '31 Oct', 'time' => '8:30 PM'],
    ];
@endphp

<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-4']) }}>
    <div class="text-sm text-muted-foreground">{{ __($heading) }}</div>

    <div class="flex flex-1 flex-col items-center gap-2">
        @foreach ($matches as $match)
            <div class="flex w-full items-center justify-between gap-2 rounded-md bg-secondary px-2 py-2">
                <x-ui.avatar :fallback="$match['home']" :alt="$match['homeName']" size="sm" class="size-7" />
                <div class="flex flex-col items-center text-xs text-muted-foreground">
                    <span>{{ $match['date'] }}</span>
                    <span>{{ $match['time'] }}</span>
                </div>
                <x-ui.avatar :fallback="$match['away']" :alt="$match['awayName']" size="sm" class="size-7" />
            </div>
        @endforeach
    </div>
</x-ui.card>

Ownership & lifecycle

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