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

4 of 7

resources/views/blocks/weather-widget-metrics.blade.php Blade
@props([
    'location' => 'San Francisco',
    'time' => '14:30',
    'temperature' => 72,
    'feelsLike' => 68,
    'humidity' => 54,
    'condition' => 'clear',
])

<x-ui.card class="w-full max-w-[15rem] aspect-square flex flex-col p-6">
    <div class="flex items-center justify-between gap-2">
        <p class="text-base font-semibold text-foreground">{{ __($location) }}</p>
        <p class="text-base font-normal tabular-nums text-muted-foreground">{{ $time }}</p>
    </div>
    <div class="flex flex-1 items-center">
        <x-ui.weather-icon :condition="$condition" size="md" class="size-9 text-muted-foreground" />
    </div>
    <div class="flex items-end justify-between gap-2">
        <div class="flex flex-col gap-2 text-foreground">
            <div class="flex items-center">
                <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="me-2 size-5 text-muted-foreground" aria-hidden="true"><path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/></svg>
                <span class="text-sm tabular-nums">{{ $feelsLike }}&deg;</span>
            </div>
            <div class="flex items-center">
                <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="me-2 size-5 text-muted-foreground" aria-hidden="true"><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"/></svg>
                <span class="text-sm tabular-nums">{{ $humidity }}%</span>
            </div>
        </div>
        <p class="text-4xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;</p>
    </div>
</x-ui.card>

Installation

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

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

card 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-metrics.md
# Brok UI block: Weather Widget Metrics (`weather-widget-metrics`)

A square weather widget pairing the current temperature with feels-like and humidity metric rows and a time header.

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-metrics
```

## Render it

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

## Props

- `location` (string, default `San Francisco`) — Location name shown in the header.
- `time` (string, default `14:30`) — Timestamp shown in the header.
- `temperature` (int, default `72`) — Current temperature value.
- `feels-like` (int, default `68`) — Feels-like temperature value.
- `humidity` (int, default `54`) — Humidity percentage value.
- `condition` (string, default `clear`) — Weather condition key that selects the icon.

## Use when

- Pairing current temperature with feels-like and humidity metric rows and a time header.
- Showing humidity as relevant context alongside temperature.

## Avoid when

- Not needing humidity data; use weather-widget-minimal instead.

## Rules

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

  • Pairing current temperature with feels-like and humidity metric rows and a time header.
  • Showing humidity as relevant context alongside temperature.

Avoid when

  • Not needing humidity data; use weather-widget-minimal 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-metrics />

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-metrics.blade.php Blade
@props([
    'location' => 'San Francisco',
    'time' => '14:30',
    'temperature' => 72,
    'feelsLike' => 68,
    'humidity' => 54,
    'condition' => 'clear',
])

<x-ui.card class="w-full max-w-[15rem] aspect-square flex flex-col p-6">
    <div class="flex items-center justify-between gap-2">
        <p class="text-base font-semibold text-foreground">{{ __($location) }}</p>
        <p class="text-base font-normal tabular-nums text-muted-foreground">{{ $time }}</p>
    </div>
    <div class="flex flex-1 items-center">
        <x-ui.weather-icon :condition="$condition" size="md" class="size-9 text-muted-foreground" />
    </div>
    <div class="flex items-end justify-between gap-2">
        <div class="flex flex-col gap-2 text-foreground">
            <div class="flex items-center">
                <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="me-2 size-5 text-muted-foreground" aria-hidden="true"><path d="M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z"/></svg>
                <span class="text-sm tabular-nums">{{ $feelsLike }}&deg;</span>
            </div>
            <div class="flex items-center">
                <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="me-2 size-5 text-muted-foreground" aria-hidden="true"><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"/></svg>
                <span class="text-sm tabular-nums">{{ $humidity }}%</span>
            </div>
        </div>
        <p class="text-4xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;</p>
    </div>
</x-ui.card>

Ownership & lifecycle

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