Skip to content
Brok UI

Loading…

No results

Productivity Widget

Open source

Focus tools — a pomodoro timer, a habit-streak card, a time-allocation ring panel, and a day planner.

Preview

resources/views/blocks/productivity-widget-pomodoro.blade.php Blade
@props([
    'title' => 'Focus Timer',
])

<x-ui.card class="w-full max-w-[15rem] flex flex-col">
    <div
        x-data="{
            total: 1500,
            left: 1500,
            running: false,
            timer: null,
            init() {},
            destroy() { clearInterval(this.timer) },
            toggle() { if (this.running) { this.pause() } else { this.start() } },
            start() {
                this.running = true;
                this.timer = setInterval(() => {
                    if (this.left > 0) this.left--;
                    else this.pause();
                }, 1000);
            },
            pause() { this.running = false; clearInterval(this.timer) },
            reset() { this.pause(); this.left = this.total },
            get mmss() {
                const m = String(Math.floor(this.left / 60)).padStart(2, '0');
                const s = String(this.left % 60).padStart(2, '0');
                return m + ':' + s;
            },
        }"
        class="flex flex-col items-center gap-4 p-6"
    >
        <div class="flex items-center gap-2">
            <span class="text-xl" aria-hidden="true">🍅</span>
            <h3 class="text-sm font-medium text-foreground">{{ __($title) }}</h3>
        </div>

        <span
            class="text-4xl font-semibold tabular-nums text-foreground"
            x-text="mmss"
            aria-live="polite"
        >25:00</span>

        <div class="flex items-center gap-2">
            <x-ui.button
                variant="default"
                size="sm"
                x-on:click="toggle()"
                x-bind:aria-label="running ? '{{ __('Pause timer') }}' : '{{ __('Start timer') }}'"
            >
                <span x-show="!running">{{ __('Start') }}</span>
                <span x-show="running" x-cloak>{{ __('Pause') }}</span>
            </x-ui.button>
            <x-ui.button
                variant="outline"
                size="sm"
                x-on:click="reset()"
                aria-label="{{ __('Reset timer') }}"
            >
                {{ __('Reset') }}
            </x-ui.button>
        </div>
    </div>
</x-ui.card>

Installation

terminal
php artisan ui:add blocks/productivity-widget-pomodoro

Installs these dependencies automatically:

Registry contract

Install confidence

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

Registry dependencies

card button

Package dependencies

composer: jml/brok:^0.2

npm: alpinejs

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.

productivity-widget-pomodoro.md
# Brok UI block: Productivity Widget Pomodoro (`productivity-widget-pomodoro`)

A compact focus-timer widget with a MM:SS countdown readout and start/pause and reset controls.

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/productivity-widget-pomodoro
```

## Render it

```blade
<x-blocks.productivity-widget-pomodoro />
```

## Props

- `title` (string, default `Focus Timer`) — Widget title shown next to the emoji.

## Use when

- Showing a compact focus/Pomodoro countdown timer with a MM:SS readout and start/pause and reset controls.
- Use when you need a small, self-contained timer widget rather than a habit streak or task checklist.

## Avoid when

- Needing a habit-streak check-in card instead of a countdown timer; use productivity-widget-habit instead.

## Rules

- Render the installed block with `<x-blocks.productivity-widget-pomodoro />` 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/productivity-widget-pomodoro
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/productivity-widget-pomodoro.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 compact focus/Pomodoro countdown timer with a MM:SS readout and start/pause and reset controls.
  • Use when you need a small, self-contained timer widget rather than a habit streak or task checklist.

Avoid when

  • Needing a habit-streak check-in card instead of a countdown timer; use productivity-widget-habit instead.

Anti-patterns

  • Do not replace semantic props with conflicting utility classes.
  • Do not remove labels, focus styles, or state attributes.
Anatomy
card title with emoji MM:SS countdown readout start/pause button reset button

Usage

Render the block as a component, passing data where useful:

resources/views/welcome.blade.php Blade
<x-blocks.productivity-widget-pomodoro />

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/productivity-widget-pomodoro.blade.php Blade
@props([
    'title' => 'Focus Timer',
])

<x-ui.card class="w-full max-w-[15rem] flex flex-col">
    <div
        x-data="{
            total: 1500,
            left: 1500,
            running: false,
            timer: null,
            init() {},
            destroy() { clearInterval(this.timer) },
            toggle() { if (this.running) { this.pause() } else { this.start() } },
            start() {
                this.running = true;
                this.timer = setInterval(() => {
                    if (this.left > 0) this.left--;
                    else this.pause();
                }, 1000);
            },
            pause() { this.running = false; clearInterval(this.timer) },
            reset() { this.pause(); this.left = this.total },
            get mmss() {
                const m = String(Math.floor(this.left / 60)).padStart(2, '0');
                const s = String(this.left % 60).padStart(2, '0');
                return m + ':' + s;
            },
        }"
        class="flex flex-col items-center gap-4 p-6"
    >
        <div class="flex items-center gap-2">
            <span class="text-xl" aria-hidden="true">🍅</span>
            <h3 class="text-sm font-medium text-foreground">{{ __($title) }}</h3>
        </div>

        <span
            class="text-4xl font-semibold tabular-nums text-foreground"
            x-text="mmss"
            aria-live="polite"
        >25:00</span>

        <div class="flex items-center gap-2">
            <x-ui.button
                variant="default"
                size="sm"
                x-on:click="toggle()"
                x-bind:aria-label="running ? '{{ __('Pause timer') }}' : '{{ __('Start timer') }}'"
            >
                <span x-show="!running">{{ __('Start') }}</span>
                <span x-show="running" x-cloak>{{ __('Pause') }}</span>
            </x-ui.button>
            <x-ui.button
                variant="outline"
                size="sm"
                x-on:click="reset()"
                aria-label="{{ __('Reset timer') }}"
            >
                {{ __('Reset') }}
            </x-ui.button>
        </div>
    </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