shadcn.io is not affiliated with official shadcn/ui
Event Countdown Banner Block for React
An event countdown for a developer conference: a calendar tile with the name and a sentence saying when it starts, four cells of days, hours, minutes and seconds in a corner-marked frame, and a Shine Button to reserve a seat.
Installation
Overview
An event countdown banner for React with Base UI, for a conference, a webinar or a launch stream. Between the page's rails sit three parts: a calendar tile with the event's name and a sentence that says when it starts ("Starts in 2 days 4 hours"), a small frame with + marks on its corners holding four cells (days, hours, minutes, seconds) split by hairlines, and an outline Shine Button, Reserve a seat. When the clock reaches zero the sentence turns into "Live now" with a status dot and the button into Join the stream. The page's rails and top rule come from the Guides spine, so the strip lines up between a header and a hero. It's built from Timer, Guides, Status and Shine Button, with CSS transitions for the entrance and your theme's tokens for every colour. For conferences, webinar reminders, ticket deadlines and any date where the time left is the message.
FAQ
Where does the clock count to?
It counts a length of time, STARTS_IN_MS at the top of the file (2 days, 4 hours and 12 minutes), and starts when the browser has rendered the page. The server draws dashes in the cells, so the server's and the browser's first render agree and nothing goes stale in a cached page. For a real event, replace the constant with the date minus now, and work it out in the effect that starts the clock, never during render: Date.parse("…") - Date.now().
What does a screen reader hear?
The sentence, not the digits. "Starts in 2 days 4 hours" is ordinary text that changes by the hour (by the minute on the last day), and the four cells are hidden from assistive technology because they repeat it. A ticking number would either stay silent or be read out every second. The one live part is a polite status line that speaks when the event goes live.
What happens at zero?
The sentence becomes "Live now. The keynote has started." with a green status dot, the status line announces "Vesperpath Live is on now.", the cells rest on zeros, and the button's label changes from Reserve a seat to Join the stream. It's the same link, so point both at the pages you need by changing the label and href together.
Where does the button go?
Reserve a seat is a link (href="#"): point it at your registration page. It's an outline Shine Button, small, so it stays quieter than the page's main call to action; a band of light sweeps across it once on hover and keyboard focus.
It renders the link it's given with render, with nativeButton={false}.
Related
- 021434Pro
Flash Sale Countdown Banner
CountdownsA flash-sale countdown for a lighting shop: the product with its struck regular price and sale price, a clock of hours, minutes and seconds in three cells, a Shine Button to claim the price, and a thin meter of how much stock is claimed.
- 09:58Pro
Session Countdown Banner
CountdownsA session timeout notice for a banking console: a shield, the minutes and seconds left, a Stay signed in button that starts the time over, a warning shield in the last minute, and a Sign in again link at zero.
- 6d 22hPro
Trial Countdown Banner
CountdownsA trial notice for a writing app: a clock, a sentence with the time left ticking, a line on what upgrading keeps, a Shine Button to upgrade and a dismiss button that folds the block away.
- Pro
Centered Countdown Timer Hero
Signup and waitlistA compact centred launch hero on solid rails with a live countdown as a full-width band of four cells and an email form whose Shine Button shows its loading and success states.
- Pro
Digit Countdown Banner
Urgency and limitsA slim early-pricing band between the page rails, in your theme: the offer at the start, then past a solid divider a live countdown to the end of this month in a small frame beside a Shine Button, with a hairline along the bottom edge that drains as the month runs out.
- Pro
Countdown Offer Pricing
Discounts and offersA launch price on a clock: a live countdown in days, hours, minutes and seconds at display size beside the headline, over three plans for a music app, one of them discounted. A Segment Group shows one plan at a time on a phone.