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

6 of 7

resources/views/blocks/weather-widget-daily.blade.php Blade
@props([
    'forecast' => [
        ['day' => 'Mon', 'min' => 58, 'max' => 74, 'condition' => 'clear'],
        ['day' => 'Tue', 'min' => 60, 'max' => 76, 'condition' => 'clouds'],
        ['day' => 'Wed', 'min' => 57, 'max' => 70, 'condition' => 'rain'],
        ['day' => 'Thu', 'min' => 55, 'max' => 68, 'condition' => 'storm'],
    ],
])

@php
    $rows = array_values($forecast);
    $lastIndex = count($rows) - 1;
@endphp

<x-ui.card class="w-full max-w-[15rem] min-h-[15rem] flex flex-col justify-center p-6">
    @foreach ($rows as $index => $day)
        <div class="grid w-full grid-cols-4 items-center gap-4">
            <span class="text-start text-base text-muted-foreground">{{ __($day['day']) }}</span>
            <x-ui.weather-icon :condition="$day['condition'] ?? 'clear'" size="sm" class="mx-auto text-muted-foreground" />
            <span class="text-center text-base tabular-nums text-muted-foreground">{{ $day['min'] }}&deg;</span>
            <span class="text-center text-base font-medium tabular-nums text-foreground">{{ $day['max'] }}&deg;</span>
        </div>
        @if ($index !== $lastIndex)
            <x-ui.separator class="my-2" />
        @endif
    @endforeach
</x-ui.card>

Installation

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

Installs these dependencies automatically:

Registry contract

Install confidence

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

A weather widget listing a four-day forecast with weekday, condition icon, and min and max temperatures per row.

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

## Render it

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

## Props

- `forecast` (array, default `[…]`) — Daily forecast rows with day, min, max and condition.

## Use when

- Listing a multi-day forecast with weekday, icon and min/max temperatures per row.
- Giving a several-day outlook rather than today's conditions.

## Avoid when

- Needing only today's or the next few hours' weather; use weather-widget-current or weather-widget-hourly instead.

## Rules

- Render the installed block with `<x-blocks.weather-widget-daily />` 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-daily
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/weather-widget-daily.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 a multi-day forecast with weekday, icon and min/max temperatures per row.
  • Giving a several-day outlook rather than today's conditions.

Avoid when

  • Needing only today's or the next few hours' weather; use weather-widget-current or weather-widget-hourly 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-daily />

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-daily.blade.php Blade
@props([
    'forecast' => [
        ['day' => 'Mon', 'min' => 58, 'max' => 74, 'condition' => 'clear'],
        ['day' => 'Tue', 'min' => 60, 'max' => 76, 'condition' => 'clouds'],
        ['day' => 'Wed', 'min' => 57, 'max' => 70, 'condition' => 'rain'],
        ['day' => 'Thu', 'min' => 55, 'max' => 68, 'condition' => 'storm'],
    ],
])

@php
    $rows = array_values($forecast);
    $lastIndex = count($rows) - 1;
@endphp

<x-ui.card class="w-full max-w-[15rem] min-h-[15rem] flex flex-col justify-center p-6">
    @foreach ($rows as $index => $day)
        <div class="grid w-full grid-cols-4 items-center gap-4">
            <span class="text-start text-base text-muted-foreground">{{ __($day['day']) }}</span>
            <x-ui.weather-icon :condition="$day['condition'] ?? 'clear'" size="sm" class="mx-auto text-muted-foreground" />
            <span class="text-center text-base tabular-nums text-muted-foreground">{{ $day['min'] }}&deg;</span>
            <span class="text-center text-base font-medium tabular-nums text-foreground">{{ $day['max'] }}&deg;</span>
        </div>
        @if ($index !== $lastIndex)
            <x-ui.separator class="my-2" />
        @endif
    @endforeach
</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