Launch sale: 40% off everything with code LAUNCH40 — applied automatically at checkout · ends 2026-12-19

2026-11-24 · Blog

Build a dependency-free launch countdown + waitlist form with Tailwind CSS v4

Every product launch needs the same page: a headline, a countdown and an email box. You don't need React for that. Here's how to build one with plain HTML, Tailwind CSS v4 and ~40 lines of vanilla JavaScript, accessible and themeable.

1. Theme with two variables

Tailwind v4 moves configuration into CSS. Define your brand once:

@import "tailwindcss";

@theme {
  --color-brand: oklch(0.62 0.21 275);
  --color-accent: oklch(0.78 0.15 195);
}

Now bg-brand, text-accent, from-brand to-accent all exist, and changing two lines re-themes everything.

2. A countdown driven by one attribute

Keep the date in the markup so non-developers can change it:

<div id="countdown" data-launch="2027-02-01T09:00:00Z"
     class="grid grid-cols-4 gap-3" role="timer" aria-live="polite">
  <div class="rounded-2xl border p-3">
    <div data-unit="days" class="text-3xl font-semibold tabular-nums">00</div>
    <div class="text-xs uppercase tracking-wider text-zinc-500">Days</div>
  </div>
  <!-- hours, minutes, seconds: same block with data-unit -->
</div>

tabular-nums stops the digits from jiggling every second — a small detail that makes it feel polished.

const box = document.getElementById("countdown");
const target = new Date(box.dataset.launch).getTime();
const units = Object.fromEntries(
  [...box.querySelectorAll("[data-unit]")].map(el => [el.dataset.unit, el])
);
const pad = n => String(n).padStart(2, "0");

function tick() {
  const s = Math.floor(Math.max(0, target - Date.now()) / 1000);
  units.days.textContent    = pad(Math.floor(s / 86400));
  units.hours.textContent   = pad(Math.floor((s % 86400) / 3600));
  units.minutes.textContent = pad(Math.floor((s % 3600) / 60));
  units.seconds.textContent = pad(s % 60);
  if (s === 0) clearInterval(timer);
}
const timer = setInterval(tick, 1000);
tick();

Using an ISO date with Z means every visitor counts down to the same moment, whatever their time zone.

3. A waitlist form that works without a backend

Services like Formspree accept a normal form POST. Progressive enhancement: the form works without JS, and with JS we stay on the page.

<form id="waitlist" action="https://formspree.io/f/your-form-id" method="post"
      class="flex flex-col gap-3 sm:flex-row">
  <label for="email" class="sr-only">Email address</label>
  <input id="email" name="email" type="email" required placeholder="you@company.com"
         class="flex-1 rounded-xl border px-4 py-3 outline-none focus:border-brand focus:ring-4 focus:ring-brand/15">
  <button class="rounded-xl bg-zinc-900 px-5 py-3 font-semibold text-white">Join waitlist</button>
</form>
<p id="waitlist-msg" aria-live="polite" class="mt-3 text-sm text-zinc-500"></p>
const form = document.getElementById("waitlist");
const msg = document.getElementById("waitlist-msg");
form.addEventListener("submit", async (e) => {
  e.preventDefault();
  msg.textContent = "Sending…";
  try {
    const r = await fetch(form.action, {
      method: "POST", body: new FormData(form), headers: { Accept: "application/json" }
    });
    msg.textContent = r.ok ? "You're on the list!" : "Something went wrong.";
    if (r.ok) form.reset();
  } catch { msg.textContent = "Network error. Try again."; }
});

Accessibility notes: the visually hidden <label> keeps screen readers happy, and aria-live="polite" announces the result without stealing focus.

4. Dark mode for free

Tailwind v4's dark: variant follows the system setting by default, so dark:bg-zinc-950 dark:text-zinc-100 on <body> is all you need for a one-pager.

Grab the finished page

I packaged this as a free template, Launchpad (countdown, waitlist form, feature cards, dark mode, Tailwind source + build): https://najoomi-templates.najoomi.workers.dev/t/launchpad/

Disclosure: I run the store that hosts it; Launchpad itself is free.

More templates like this

Excel & Google Sheets templates, planners, website templates and AI kits.

Browse the catalog