Skip to content
Brok UI

Loading…

No results

Weather Widget

Open source

Compact weather cards — current conditions, minimalist, extended with high/low, metric tiles, hourly strip, four-day forecast and a wide metrics dashboard.

Preview

7 of 7

resources/views/blocks/weather-widget-dashboard.blade.php Blade
@props([
    'location' => 'San Francisco',
    'temperature' => 72,
    'condition' => 'clear',
    'windSpeed' => 12,
    'feelsLike' => 68,
    'precipitation' => 0,
    'humidity' => 54,
])

@php
    $metrics = [
        ['label' => 'Wind speed', 'value' => $windSpeed.' km/h', 'icon' => '<path d="M12.8 19.6A2 2 0 1 0 14 16H2"/><path d="M17.5 8a2.5 2.5 0 1 1 2 4H2"/><path d="M9.8 4.4A2 2 0 1 1 11 8H2"/>'],
        ['label' => 'Feels like', 'value' => $feelsLike.'°', 'icon' => '<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>'],
        ['label' => 'Precipitation', 'value' => $precipitation.' mm', 'icon' => '<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242"/><path d="M16 14v6"/><path d="M8 14v6"/><path d="M12 16v6"/>'],
        ['label' => 'Humidity', 'value' => $humidity.'%', 'icon' => '<path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"/>'],
    ];
@endphp

<x-ui.card class="w-full max-w-md flex flex-col gap-6 p-6">
    <div class="flex w-full flex-col items-center justify-center gap-4 text-center">
        <x-ui.weather-icon :condition="$condition" size="xl" class="text-muted-foreground" />
        <div class="flex flex-col items-center gap-2">
            <p class="text-3xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;C</p>
            <p class="text-base text-muted-foreground">{{ __($location) }}</p>
        </div>
    </div>
    <x-ui.separator />
    <div class="grid grid-cols-2 gap-4">
        @foreach ($metrics as $metric)
            <div class="flex items-center gap-4 rounded-lg bg-muted p-6">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-6 shrink-0 text-muted-foreground" aria-hidden="true">{!! $metric['icon'] !!}</svg>
                <dl class="flex flex-col">
                    <dt class="text-xs text-muted-foreground">{{ __($metric['label']) }}</dt>
                    <dd class="text-base font-medium tabular-nums text-foreground">{{ $metric['value'] }}</dd>
                </dl>
            </div>
        @endforeach
    </div>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/weather-widget-dashboard

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

card separator weather-icon

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.

weather-widget-dashboard.md
# Brok UI block: Weather Widget Dashboard (`weather-widget-dashboard`)

A wide weather widget with a hero temperature and location above a 2x2 grid of wind, feels-like, precipitation, and humidity tiles.

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/weather-widget-dashboard
```

## Render it

```blade
<x-blocks.weather-widget-dashboard />
```

## Props

- `location` (string, default `San Francisco`) — Location name shown under the temperature.
- `temperature` (int, default `72`) — Current temperature value.
- `condition` (string, default `clear`) — Weather condition key that selects the icon.
- `wind-speed` (int, default `12`) — Wind speed value shown in the metrics grid.
- `feels-like` (int, default `68`) — Feels-like temperature shown in the metrics grid.
- `precipitation` (int, default `0`) — Precipitation amount shown in the metrics grid.
- `humidity` (int, default `54`) — Humidity percentage shown in the metrics grid.

## Use when

- Showing a hero temperature alongside a 2x2 grid of wind, feels-like, precipitation and humidity metrics.
- Making the widget the most detailed weather summary on a dashboard.

## Avoid when

- Needing a compact single-metric card instead of a full metrics grid; use weather-widget-current through weather-widget-metrics instead.

## Rules

- Render the installed block with `<x-blocks.weather-widget-dashboard />` 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/weather-widget-dashboard
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/weather-widget-dashboard.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 a hero temperature alongside a 2x2 grid of wind, feels-like, precipitation and humidity metrics.
  • Making the widget the most detailed weather summary on a dashboard.

Avoid when

  • Needing a compact single-metric card instead of a full metrics grid; use weather-widget-current through weather-widget-metrics 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.weather-widget-dashboard />

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/weather-widget-dashboard.blade.php Blade
@props([
    'location' => 'San Francisco',
    'temperature' => 72,
    'condition' => 'clear',
    'windSpeed' => 12,
    'feelsLike' => 68,
    'precipitation' => 0,
    'humidity' => 54,
])

@php
    $metrics = [
        ['label' => 'Wind speed', 'value' => $windSpeed.' km/h', 'icon' => '<path d="M12.8 19.6A2 2 0 1 0 14 16H2"/><path d="M17.5 8a2.5 2.5 0 1 1 2 4H2"/><path d="M9.8 4.4A2 2 0 1 1 11 8H2"/>'],
        ['label' => 'Feels like', 'value' => $feelsLike.'°', 'icon' => '<path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/>'],
        ['label' => 'Precipitation', 'value' => $precipitation.' mm', 'icon' => '<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242"/><path d="M16 14v6"/><path d="M8 14v6"/><path d="M12 16v6"/>'],
        ['label' => 'Humidity', 'value' => $humidity.'%', 'icon' => '<path d="M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z"/>'],
    ];
@endphp

<x-ui.card class="w-full max-w-md flex flex-col gap-6 p-6">
    <div class="flex w-full flex-col items-center justify-center gap-4 text-center">
        <x-ui.weather-icon :condition="$condition" size="xl" class="text-muted-foreground" />
        <div class="flex flex-col items-center gap-2">
            <p class="text-3xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;C</p>
            <p class="text-base text-muted-foreground">{{ __($location) }}</p>
        </div>
    </div>
    <x-ui.separator />
    <div class="grid grid-cols-2 gap-4">
        @foreach ($metrics as $metric)
            <div class="flex items-center gap-4 rounded-lg bg-muted p-6">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-6 shrink-0 text-muted-foreground" aria-hidden="true">{!! $metric['icon'] !!}</svg>
                <dl class="flex flex-col">
                    <dt class="text-xs text-muted-foreground">{{ __($metric['label']) }}</dt>
                    <dd class="text-base font-medium tabular-nums text-foreground">{{ $metric['value'] }}</dd>
                </dl>
            </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.1.1
Status
Stable
License
open
Deprecation
Not deprecated
Contract
v1
Foundation
≥ 1.0.0