shadcn.io is not affiliated with official shadcn/ui
Pomodoro Timer Dialog Block for React
A focus timer's Today page with its dialog shown open: a Focus, Short break and Long break switch, a ring that fills with the digits inside it, Start and Pause, four session dots and durations that apply at the next start.
Installation
Overview
Run work in rounds with rests between them, with this pomodoro timer for React with Base UI. It opens from the Today page of Tomatrail, a focus timer: the page's header holds an outline Focus Button, and the page, one task card with a progress bar and a chip that says what the clock is doing, is drawn under a soft scrim inside a hairline frame with a plus mark on each corner. The Dialog has a Segment Group for the phase (Focus 25, Short break 5, Long break 15), a Circular Progress ring that fills as the phase runs with the digits inside it, Start and Pause in one place beside Reset and Skip, four session dots, and a Durations disclosure with three Number Inputs. The clock is the catalog Timer, kept out of sight, so it keeps counting when the dialog closes and the chip on the page follows it. When a phase runs out the next one starts by itself, a long break after the fourth focus. Start is the only Shine Button. For preview the dialog is drawn open in place when the page loads, its clock stopped at 25:00; Start begins it.
FAQ
Why is the dialog already open, and why is the clock stopped?
So you can see it without a click, and so a poster or a gallery card never ages. On load the dialog is a copy drawn in place over the page: a native dialog element that isn't modal, so nothing is trapped, hidden or focused. In it the clock stands at 25:00 until you press Start, and then it really runs. The Focus button in the header opens the real Dialog, modal, with its focus trap, Escape and focus return, and the copy stays closed until a reload. Both show the same FocusFields component and share the block's state, including a clock that is already running. In your app keep the Dialog and drop the copy.
How do the phases and the sessions work?
Focus, then a short break, then focus again, with a long break after the fourth focus, after which the count starts over. A finished focus fills the next session dot; Skip moves on without counting the round, and Reset puts the current phase back to its full length. Picking a phase by hand stops the clock at that phase's length. The phase moves by itself and says so once in the polite status, such as "Short break started"; it does not announce every second.
When do the durations apply?
At the next start of a phase, never in the middle of one: type new minutes (1 to 90, whole numbers) under Durations and the running clock is untouched until a phase begins, a Skip, a Reset or the next Start from a fresh phase. A length that is out of range says so and the old length stays.
What does a screen reader hear, and can the clock be paused?
The status line speaks when you start, pause, resume, reset or skip, and when a phase changes: never every second. The digits are plain text you can read whenever you like, and the ring is decoration. Pause is a real button next to Start, and Reset and Skip are beside them. The clock is the catalog Timer, counting one second at a time; the ring's fill follows it and stops animating under reduced motion while the digits keep running.
What stays local, and how do I wire it for real?
Everything. Nothing plays, no sound is made, and no session is recorded: the dots, the chip and the clock live in this page's state. In your app save each finished focus on your server, play a sound or send a notification from the phase change (finish is the place), and persist the chosen lengths with the person's settings.
How does it look on a phone?
The copy shown on load docks to the foot of the page as a bottom sheet with its Done button pinned and the content scrolling above it; the phase switch, the ring and Start come first. The three phases wrap their labels instead of shrinking, and the durations sit in three narrow columns. The real dialog keeps the Dialog's own phone layout, a sheet stuck to the bottom of the screen.
Related
- Pro
Sleep Timer Dialog
Drawers and popoversA podcast player with its sleep timer drawer shown open: presets and a fine-tune slider, the stop time worked out from a typed clock, a fade switch, a linear track with the fade zone hatched, and a running state with the time left.
- Pro
Session Timeout Dialog
Status and errorsA bank's accounts page with an alert dialog shown open that warns before an idle session ends: a one-minute clock with a draining bar, Stay signed in and Sign out now, and a signed-out view at zero.
- Pro
Set Reminder Dialog
Time and schedulingA to-do list with its reminder dialog shown open: five quick chips, an inline calendar and a time in quarter hours, repeat and notify choices, and one plain sentence that always reads the choice back.
- Pro
Meeting RSVP Dialog
Time and schedulingA team calendar's week with its reply dialog shown open: the event, a three-way Going, Maybe or Can't go answer, an optional note, and the guests by answer with their counts, moving as you choose.
- Pro
Schedule Meeting Dialog
Time and schedulingA month page with its new event dialog shown open: a title, a day from a folded calendar, a start time and length, guest emails as tags, and a day timeline that moves with the time and warns when the meeting clashes.
- Pro
Streak Tracker Dialog
Time and schedulingA habit app's list with a daily check-in dialog shown open: a flame and the days in a row, a five-week calendar with this week's days large, milestones at 7, 14 and 30, and a check-in that moves the number.