Skip to content
Brok UI

Loading…

No results

Calendar Widget

Open source

Decorative calendar cards — a per-day pricing grid, a week picker with tasks, and a day agenda with accent bars.

Preview

resources/views/blocks/calendar-widget-pricing.blade.php Blade
@props([
    'month'    => 'Jun 2026',
    'weekdays' => null,
    'firstDay' => 0,
    'days'     => 30,
])

@php
    $weekdays ??= ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

    // Synthetic, deterministic prices so the widget renders with no args.
    $cells = [];
    for ($i = 0; $i < $firstDay; $i++) {
        $cells[] = null;
    }
    for ($d = 1; $d <= $days; $d++) {
        $price = 80 + (($d * 37) % 171); // 80..250, repeatable
        $cells[] = ['day' => $d, 'price' => $price, 'deal' => $price < 120];
    }
@endphp

<x-ui.card class="w-full max-w-md flex flex-col gap-4 p-4">
    <div class="flex items-center justify-between gap-2">
        <button type="button" aria-label="{{ __('Previous month') }}" class="inline-flex size-8 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-muted">
            <svg class="size-4 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                <path d="m15 18-6-6 6-6" />
            </svg>
        </button>
        <h3 class="text-2xl font-semibold text-foreground">{{ $month }}</h3>
        <button type="button" aria-label="{{ __('Next month') }}" class="inline-flex size-8 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-muted">
            <svg class="size-4 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                <path d="m9 18 6-6-6-6" />
            </svg>
        </button>
    </div>

    <x-ui.separator />

    <div class="grid grid-cols-7 gap-2">
        @foreach ($weekdays as $wd)
            <div class="text-center text-sm font-semibold text-muted-foreground">{{ $wd }}</div>
        @endforeach

        @foreach ($cells as $cell)
            @if ($cell === null)
                <div aria-hidden="true"></div>
            @else
                <div class="flex flex-col items-center justify-center gap-0.5 rounded-md py-2 text-center">
                    <span class="text-sm font-semibold leading-none text-foreground">{{ $cell['day'] }}</span>
                    <span @class([
                        'text-xs leading-tight',
                        'text-success font-medium' => $cell['deal'],
                        'text-muted-foreground' => ! $cell['deal'],
                    ])>${{ $cell['price'] }}</span>
                </div>
            @endif
        @endforeach
    </div>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/calendar-widget-pricing

Installs these dependencies automatically:

Registry contract

Install confidence

php artisan ui:add blocks/calendar-widget-pricing 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/calendar-widget-pricing.blade.php

Registry dependencies

card separator

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.

calendar-widget-pricing.md
# Brok UI block: Calendar Widget Pricing (`calendar-widget-pricing`)

A month calendar widget whose day cells show a per-day price, with deal prices highlighted in the success token.

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/calendar-widget-pricing
```

## Render it

```blade
<x-blocks.calendar-widget-pricing />
```

## Props

- `month` (string, default `Jun 2026`)
- `weekdays` (mixed|null, default `null`)
- `first-day` (int, default `0`)
- `days` (int, default `30`)

## Use when

- Showing a month calendar where each day cell displays a per-day price, with deal days highlighted in the success token.
- Giving a booking or travel page a compact price-aware date picker widget.

## Avoid when

- Use calendar-widget-week for a week/task view, or calendar-widget-agenda for a single-day agenda instead of a full month grid.

## Rules

- Render the installed block with `<x-blocks.calendar-widget-pricing />` 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/calendar-widget-pricing
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/calendar-widget-pricing.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 month calendar where each day cell displays a per-day price, with deal days highlighted in the success token.
  • Giving a booking or travel page a compact price-aware date picker widget.

Avoid when

  • Use calendar-widget-week for a week/task view, or calendar-widget-agenda for a single-day agenda instead of a full month grid.

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.calendar-widget-pricing />

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/calendar-widget-pricing.blade.php Blade
@props([
    'month'    => 'Jun 2026',
    'weekdays' => null,
    'firstDay' => 0,
    'days'     => 30,
])

@php
    $weekdays ??= ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

    // Synthetic, deterministic prices so the widget renders with no args.
    $cells = [];
    for ($i = 0; $i < $firstDay; $i++) {
        $cells[] = null;
    }
    for ($d = 1; $d <= $days; $d++) {
        $price = 80 + (($d * 37) % 171); // 80..250, repeatable
        $cells[] = ['day' => $d, 'price' => $price, 'deal' => $price < 120];
    }
@endphp

<x-ui.card class="w-full max-w-md flex flex-col gap-4 p-4">
    <div class="flex items-center justify-between gap-2">
        <button type="button" aria-label="{{ __('Previous month') }}" class="inline-flex size-8 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-muted">
            <svg class="size-4 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                <path d="m15 18-6-6 6-6" />
            </svg>
        </button>
        <h3 class="text-2xl font-semibold text-foreground">{{ $month }}</h3>
        <button type="button" aria-label="{{ __('Next month') }}" class="inline-flex size-8 items-center justify-center rounded-md border border-border bg-background text-muted-foreground transition-colors hover:bg-muted">
            <svg class="size-4 rtl:rotate-180" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
                <path d="m9 18 6-6-6-6" />
            </svg>
        </button>
    </div>

    <x-ui.separator />

    <div class="grid grid-cols-7 gap-2">
        @foreach ($weekdays as $wd)
            <div class="text-center text-sm font-semibold text-muted-foreground">{{ $wd }}</div>
        @endforeach

        @foreach ($cells as $cell)
            @if ($cell === null)
                <div aria-hidden="true"></div>
            @else
                <div class="flex flex-col items-center justify-center gap-0.5 rounded-md py-2 text-center">
                    <span class="text-sm font-semibold leading-none text-foreground">{{ $cell['day'] }}</span>
                    <span @class([
                        'text-xs leading-tight',
                        'text-success font-medium' => $cell['deal'],
                        'text-muted-foreground' => ! $cell['deal'],
                    ])>${{ $cell['price'] }}</span>
                </div>
            @endif
        @endforeach
    </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