Calendar Widget
Decorative calendar cards — a per-day pricing grid, a week picker with tasks, and a day agenda with accent bars.
Preview
@props([
'headerDate' => '9 June',
'weekdays' => null,
'days' => null,
'selected' => 9,
'tasks' => null,
])
@php
$weekdays ??= ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
$days ??= [6, 7, 8, 9, 10, 11, 12];
$tasks ??= [
['title' => 'Teach Theo Elixir', 'time' => '8:30 AM', 'initials' => 'TE'],
['title' => 'Meeting with the design team', 'time' => '12:30 PM', 'initials' => 'DT'],
['title' => 'Teaching Tailwind', 'time' => '4:30 PM', 'initials' => 'TW'],
];
@endphp
<x-ui.card class="w-full max-w-sm flex flex-col p-0">
<div class="flex items-center justify-between gap-2 rounded-t-lg bg-primary p-6 text-primary-foreground">
<h3 class="text-2xl font-semibold">{{ $headerDate }}</h3>
<span class="inline-flex items-center rounded-full bg-primary-foreground px-4 py-2 text-sm font-medium text-primary">{{ __('Today') }}</span>
</div>
<div class="flex flex-col gap-4 p-4">
<div class="flex items-center justify-between gap-2">
<button type="button" aria-label="{{ __('Previous day') }}" class="inline-flex size-8 shrink-0 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>
<div class="grid w-full grid-cols-7 gap-x-2">
@foreach ($weekdays as $wd)
<span class="mx-auto text-sm text-muted-foreground">{{ $wd }}</span>
@endforeach
@foreach ($days as $d)
<button type="button" @class([
'mx-auto inline-flex size-8 items-center justify-center rounded-full text-base transition-colors',
'bg-primary text-primary-foreground font-semibold' => $d === $selected,
'text-foreground hover:bg-muted' => $d !== $selected,
]) @if ($d === $selected) aria-current="date" @endif>{{ $d }}</button>
@endforeach
</div>
<button type="button" aria-label="{{ __('Next day') }}" class="inline-flex size-8 shrink-0 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>
<ul class="flex flex-col">
@foreach ($tasks as $task)
<li @class([
'flex items-center gap-x-4 py-4',
'border-b border-border' => ! $loop->last,
])>
<x-ui.avatar size="lg" :fallback="$task['initials']" :alt="$task['title']" />
<div class="space-y-0.5">
<p class="text-base text-foreground">{{ $task['title'] }}</p>
<p class="text-sm text-muted-foreground">{{ $task['time'] }}</p>
</div>
</li>
@endforeach
</ul>
</div>
</x-ui.card>
Installation
php artisan ui:add blocks/calendar-widget-week
Registry contract
Install confidence
php artisan ui:add blocks/calendar-widget-week
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.4
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/calendar-widget-week.blade.php |
Registry dependencies
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.
# Brok UI block: Calendar Widget Week (`calendar-widget-week`)
A week calendar widget with a coloured header band, a seven-day picker strip, and a list of scheduled tasks with avatars.
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-week
```
## Render it
```blade
<x-blocks.calendar-widget-week />
```
## Props
- `header-date` (string, default `9 June`)
- `weekdays` (mixed|null, default `null`)
- `days` (mixed|null, default `null`)
- `selected` (int, default `9`)
- `tasks` (mixed|null, default `null`)
## Use when
- Showing a seven-day week strip with a coloured header band above a list of that day's scheduled tasks with avatars.
- Letting a viewer see both the week's date picker and the selected day's agenda in one compact card.
## Avoid when
- Use calendar-widget-pricing for a full month price grid, or calendar-widget-agenda for a single-day agenda without a week strip.
## Rules
- Render the installed block with `<x-blocks.calendar-widget-week />` 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-week
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/calendar-widget-week.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 seven-day week strip with a coloured header band above a list of that day's scheduled tasks with avatars.
- Letting a viewer see both the week's date picker and the selected day's agenda in one compact card.
Avoid when
- Use calendar-widget-pricing for a full month price grid, or calendar-widget-agenda for a single-day agenda without a week strip.
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:
<x-blocks.calendar-widget-week />
Built from primitives
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.
@props([
'headerDate' => '9 June',
'weekdays' => null,
'days' => null,
'selected' => 9,
'tasks' => null,
])
@php
$weekdays ??= ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
$days ??= [6, 7, 8, 9, 10, 11, 12];
$tasks ??= [
['title' => 'Teach Theo Elixir', 'time' => '8:30 AM', 'initials' => 'TE'],
['title' => 'Meeting with the design team', 'time' => '12:30 PM', 'initials' => 'DT'],
['title' => 'Teaching Tailwind', 'time' => '4:30 PM', 'initials' => 'TW'],
];
@endphp
<x-ui.card class="w-full max-w-sm flex flex-col p-0">
<div class="flex items-center justify-between gap-2 rounded-t-lg bg-primary p-6 text-primary-foreground">
<h3 class="text-2xl font-semibold">{{ $headerDate }}</h3>
<span class="inline-flex items-center rounded-full bg-primary-foreground px-4 py-2 text-sm font-medium text-primary">{{ __('Today') }}</span>
</div>
<div class="flex flex-col gap-4 p-4">
<div class="flex items-center justify-between gap-2">
<button type="button" aria-label="{{ __('Previous day') }}" class="inline-flex size-8 shrink-0 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>
<div class="grid w-full grid-cols-7 gap-x-2">
@foreach ($weekdays as $wd)
<span class="mx-auto text-sm text-muted-foreground">{{ $wd }}</span>
@endforeach
@foreach ($days as $d)
<button type="button" @class([
'mx-auto inline-flex size-8 items-center justify-center rounded-full text-base transition-colors',
'bg-primary text-primary-foreground font-semibold' => $d === $selected,
'text-foreground hover:bg-muted' => $d !== $selected,
]) @if ($d === $selected) aria-current="date" @endif>{{ $d }}</button>
@endforeach
</div>
<button type="button" aria-label="{{ __('Next day') }}" class="inline-flex size-8 shrink-0 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>
<ul class="flex flex-col">
@foreach ($tasks as $task)
<li @class([
'flex items-center gap-x-4 py-4',
'border-b border-border' => ! $loop->last,
])>
<x-ui.avatar size="lg" :fallback="$task['initials']" :alt="$task['title']" />
<div class="space-y-0.5">
<p class="text-base text-foreground">{{ $task['title'] }}</p>
<p class="text-sm text-muted-foreground">{{ $task['time'] }}</p>
</div>
</li>
@endforeach
</ul>
</div>
</x-ui.card>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.4 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0