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

5 of 7

resources/views/blocks/weather-widget-hourly.blade.php Blade
@props([
    'location' => 'San Francisco',
    'temperature' => 72,
    'feelsLike' => 68,
    'high' => 76,
    'low' => 61,
    'hourly' => [
        ['time' => '3PM', 'temp' => 72, 'condition' => 'clear'],
        ['time' => '4PM', 'temp' => 73, 'condition' => 'clear'],
        ['time' => '5PM', 'temp' => 71, 'condition' => 'clouds'],
        ['time' => '6PM', 'temp' => 68, 'condition' => 'clouds'],
        ['time' => '7PM', 'temp' => 65, 'condition' => 'rain'],
    ],
])

<x-ui.card class="w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-6">
    <div class="flex items-center justify-between gap-4">
        <div class="flex flex-col gap-2">
            <p class="text-base font-semibold text-foreground">{{ __($location) }}</p>
            <p class="text-sm text-muted-foreground">{{ __('Feels like') }} {{ $feelsLike }}&deg;</p>
        </div>
        <p class="text-3xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;</p>
    </div>
    <div class="flex items-center justify-between gap-2">
        <div class="flex items-center text-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="me-2 size-4" aria-hidden="true"><path d="M8 6L12 2L16 6"/><path d="M12 2v20"/></svg>
            <span class="text-sm font-medium tabular-nums">{{ $high }}&deg;</span>
        </div>
        <div class="flex items-center text-muted-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="me-2 size-4" aria-hidden="true"><path d="M8 18L12 22L16 18"/><path d="M12 2v20"/></svg>
            <span class="text-sm font-medium tabular-nums">{{ $low }}&deg;</span>
        </div>
    </div>
    <x-ui.separator class="mt-auto" />
    <div class="flex items-center justify-between gap-2 rounded-md bg-muted p-2">
        @foreach ($hourly as $hour)
            <div class="flex flex-col items-center gap-2">
                <span class="text-sm text-muted-foreground">{{ $hour['time'] }}</span>
                <x-ui.weather-icon :condition="$hour['condition'] ?? 'clear'" size="sm" class="text-muted-foreground" />
                <span class="text-sm font-normal tabular-nums text-foreground">{{ $hour['temp'] }}&deg;</span>
            </div>
        @endforeach
    </div>
</x-ui.card>

Installation

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

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/weather-widget-hourly 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-hourly.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-hourly.md
# Brok UI block: Weather Widget Hourly (`weather-widget-hourly`)

A weather widget with current and high/low temperatures above a five-hour forecast strip of icons and temps.

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

## Render it

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

## Props

- `location` (string, default `San Francisco`) — Location name shown in the header.
- `temperature` (int, default `72`) — Current temperature value.
- `feels-like` (int, default `68`) — Feels-like temperature value.
- `high` (int, default `76`) — Day's high temperature.
- `low` (int, default `61`) — Day's low temperature.
- `hourly` (array, default `[…]`) — Hourly forecast entries with time, temperature and condition.

## Use when

- Showing current conditions above a five-hour forecast strip of icons and temperatures.
- Giving an hour-by-hour outlook rather than just today's reading.

## Avoid when

- Needing a multi-day forecast instead of hourly; use weather-widget-daily instead.

## Rules

- Render the installed block with `<x-blocks.weather-widget-hourly />` 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-hourly
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/weather-widget-hourly.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 current conditions above a five-hour forecast strip of icons and temperatures.
  • Giving an hour-by-hour outlook rather than just today's reading.

Avoid when

  • Needing a multi-day forecast instead of hourly; use weather-widget-daily 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-hourly />

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-hourly.blade.php Blade
@props([
    'location' => 'San Francisco',
    'temperature' => 72,
    'feelsLike' => 68,
    'high' => 76,
    'low' => 61,
    'hourly' => [
        ['time' => '3PM', 'temp' => 72, 'condition' => 'clear'],
        ['time' => '4PM', 'temp' => 73, 'condition' => 'clear'],
        ['time' => '5PM', 'temp' => 71, 'condition' => 'clouds'],
        ['time' => '6PM', 'temp' => 68, 'condition' => 'clouds'],
        ['time' => '7PM', 'temp' => 65, 'condition' => 'rain'],
    ],
])

<x-ui.card class="w-full max-w-[15rem] min-h-[15rem] flex flex-col gap-4 p-6">
    <div class="flex items-center justify-between gap-4">
        <div class="flex flex-col gap-2">
            <p class="text-base font-semibold text-foreground">{{ __($location) }}</p>
            <p class="text-sm text-muted-foreground">{{ __('Feels like') }} {{ $feelsLike }}&deg;</p>
        </div>
        <p class="text-3xl font-semibold tabular-nums text-foreground">{{ $temperature }}&deg;</p>
    </div>
    <div class="flex items-center justify-between gap-2">
        <div class="flex items-center text-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="me-2 size-4" aria-hidden="true"><path d="M8 6L12 2L16 6"/><path d="M12 2v20"/></svg>
            <span class="text-sm font-medium tabular-nums">{{ $high }}&deg;</span>
        </div>
        <div class="flex items-center text-muted-foreground">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="me-2 size-4" aria-hidden="true"><path d="M8 18L12 22L16 18"/><path d="M12 2v20"/></svg>
            <span class="text-sm font-medium tabular-nums">{{ $low }}&deg;</span>
        </div>
    </div>
    <x-ui.separator class="mt-auto" />
    <div class="flex items-center justify-between gap-2 rounded-md bg-muted p-2">
        @foreach ($hourly as $hour)
            <div class="flex flex-col items-center gap-2">
                <span class="text-sm text-muted-foreground">{{ $hour['time'] }}</span>
                <x-ui.weather-icon :condition="$hour['condition'] ?? 'clear'" size="sm" class="text-muted-foreground" />
                <span class="text-sm font-normal tabular-nums text-foreground">{{ $hour['temp'] }}&deg;</span>
            </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