Sports Widget
Live and final sports cards — football scoreboard, live match, fixtures list, cricket scorecard and commentary, and a basketball period breakdown.
Preview
@props([
'match' => 'IND vs NZ',
'total' => '340/7',
'batters' => null,
'bowlers' => null,
'chaser' => 'IND',
'runsNeeded' => '26',
'ballsLeft' => '18',
])
@php
$batters ??= [
['team' => 'IND', 'teamName' => 'India', 'player' => 'Pratika R', 'score' => '122', 'balls' => '134'],
['team' => 'IND', 'teamName' => 'India', 'player' => 'Smriti M', 'score' => '109*', 'balls' => '95'],
];
$bowlers ??= [
['team' => 'NZ', 'teamName' => 'New Zealand', 'player' => 'Eden C', 'score' => '2/76', 'balls' => '6.0'],
];
@endphp
<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-4']) }}>
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<span class="size-2 motion-safe:animate-pulse rounded-full bg-success" aria-hidden="true"></span>
<span class="text-sm text-muted-foreground">{{ __($match) }}</span>
</div>
<span class="text-sm tabular-nums text-foreground">{{ $total }}</span>
</div>
<div class="flex flex-1 flex-col justify-center gap-2">
<div class="flex w-full flex-col gap-4">
@foreach ($batters as $batter)
<div class="flex w-full items-center justify-between gap-2">
<div class="flex items-center gap-2">
<x-ui.avatar :fallback="$batter['team']" :alt="$batter['teamName']" size="xs" class="size-4 text-2xs" />
<span class="text-xs text-foreground">{{ $batter['player'] }}</span>
</div>
<span class="text-xs tabular-nums text-foreground">
{{ $batter['score'] }}<span class="text-muted-foreground">({{ $batter['balls'] }})</span>
</span>
</div>
@endforeach
</div>
<x-ui.separator class="my-2" />
<div class="flex w-full flex-col gap-4">
@foreach ($bowlers as $bowler)
<div class="flex w-full items-center justify-between gap-2">
<div class="flex items-center gap-2">
<x-ui.avatar :fallback="$bowler['team']" :alt="$bowler['teamName']" size="xs" class="size-4 text-2xs" />
<span class="text-xs text-foreground">{{ $bowler['player'] }}</span>
</div>
<span class="text-xs tabular-nums text-foreground">
{{ $bowler['score'] }}<span class="text-muted-foreground">({{ $bowler['balls'] }})</span>
</span>
</div>
@endforeach
</div>
</div>
<div class="flex justify-center text-sm text-muted-foreground">
<p>
{{ $chaser }} {{ __('needs') }}
<span class="font-medium text-success">{{ $runsNeeded }}</span>
{{ __('from') }}
<span class="font-medium text-success">{{ $ballsLeft }}</span>
</p>
</div>
</x-ui.card>
Installation
php artisan ui:add blocks/sports-widget-commentary
Registry contract
Install confidence
php artisan ui:add blocks/sports-widget-commentary
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-commentary.blade.php |
Registry dependencies
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.
# Brok UI block: Sports Widget Commentary (`sports-widget-commentary`)
Live cricket commentary widget with batter and bowler rows separated by a divider and a chase target footer.
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-commentary
```
## Render it
```blade
<x-blocks.sports-widget-commentary />
```
## Props
- `match` (string, default `IND vs NZ`) — Match label shown in the header.
- `total` (string, default `340/7`) — Current team total shown in the header.
- `batters` (mixed|null, default `null`) — Batter rows with team, player, score and balls faced; null falls back to sample data.
- `bowlers` (mixed|null, default `null`) — Bowler rows with team, player, figures and overs; null falls back to sample data.
- `chaser` (string, default `IND`) — Abbreviation of the team currently chasing.
- `runs-needed` (string, default `26`) — Runs still needed by the chasing team.
- `balls-left` (string, default `18`) — Balls remaining in the chase.
## Use when
- Showing live cricket commentary detail with batter and bowler rows plus a chase target.
- Needing player-level stats rather than just the innings totals.
## Avoid when
- Needing only the innings summary without player detail; use sports-widget-cricket instead.
## Rules
- Render the installed block with `<x-blocks.sports-widget-commentary />` 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-commentary
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/sports-widget-commentary.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 live cricket commentary detail with batter and bowler rows plus a chase target.
- Needing player-level stats rather than just the innings totals.
Avoid when
- Needing only the innings summary without player detail; use sports-widget-cricket 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:
<x-blocks.sports-widget-commentary />
Built from primitives
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.
@props([
'match' => 'IND vs NZ',
'total' => '340/7',
'batters' => null,
'bowlers' => null,
'chaser' => 'IND',
'runsNeeded' => '26',
'ballsLeft' => '18',
])
@php
$batters ??= [
['team' => 'IND', 'teamName' => 'India', 'player' => 'Pratika R', 'score' => '122', 'balls' => '134'],
['team' => 'IND', 'teamName' => 'India', 'player' => 'Smriti M', 'score' => '109*', 'balls' => '95'],
];
$bowlers ??= [
['team' => 'NZ', 'teamName' => 'New Zealand', 'player' => 'Eden C', 'score' => '2/76', 'balls' => '6.0'],
];
@endphp
<x-ui.card {{ $attributes->merge(['class' => 'w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-4']) }}>
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<span class="size-2 motion-safe:animate-pulse rounded-full bg-success" aria-hidden="true"></span>
<span class="text-sm text-muted-foreground">{{ __($match) }}</span>
</div>
<span class="text-sm tabular-nums text-foreground">{{ $total }}</span>
</div>
<div class="flex flex-1 flex-col justify-center gap-2">
<div class="flex w-full flex-col gap-4">
@foreach ($batters as $batter)
<div class="flex w-full items-center justify-between gap-2">
<div class="flex items-center gap-2">
<x-ui.avatar :fallback="$batter['team']" :alt="$batter['teamName']" size="xs" class="size-4 text-2xs" />
<span class="text-xs text-foreground">{{ $batter['player'] }}</span>
</div>
<span class="text-xs tabular-nums text-foreground">
{{ $batter['score'] }}<span class="text-muted-foreground">({{ $batter['balls'] }})</span>
</span>
</div>
@endforeach
</div>
<x-ui.separator class="my-2" />
<div class="flex w-full flex-col gap-4">
@foreach ($bowlers as $bowler)
<div class="flex w-full items-center justify-between gap-2">
<div class="flex items-center gap-2">
<x-ui.avatar :fallback="$bowler['team']" :alt="$bowler['teamName']" size="xs" class="size-4 text-2xs" />
<span class="text-xs text-foreground">{{ $bowler['player'] }}</span>
</div>
<span class="text-xs tabular-nums text-foreground">
{{ $bowler['score'] }}<span class="text-muted-foreground">({{ $bowler['balls'] }})</span>
</span>
</div>
@endforeach
</div>
</div>
<div class="flex justify-center text-sm text-muted-foreground">
<p>
{{ $chaser }} {{ __('needs') }}
<span class="font-medium text-success">{{ $runsNeeded }}</span>
{{ __('from') }}
<span class="font-medium text-success">{{ $ballsLeft }}</span>
</p>
</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