Made in

Join us for the biggest Figma-to-code launch of the year logo
Talk to Us
Talk to Us










Visual CMS

Drag-and-drop visual editor and headless CMS for any tech stack

Theme Studio for Shopify

Build and optimize your Shopify-hosted storefront, no coding required



Get StartedLogin

Popular Tutorials


Create a Countdown Timer Hero

Create a Countdown Timer Hero

This tutorial covers two options for adding a countdown hero to your project, one based solely in the Visual Editor that uses a built-in template, and for those who want more fine-grained control, a custom code option.

Skill set: Intermediate

Area: UI OR code

Video Length: 21 sec

  • You'll need a Builder account.
  • An evergreen browser; that is, a modern, up-to-date browser such as Google Chrome.

Use the Countdown featured template, as in the video:

  1. Go the Insert tab > Featured Templates
  2. Click View All Templates.
  3. Search for "countdown".
  4. Choose one of the countdown templates.

If you have access to code features, you can create a countdown with custom code. Note that we recommend that a developer finetune this example implementation.

In this example, the days text box is bound to state.days, the hours is bound to state.hours, the minutes are bound to state.minutes, and the seconds are bound to state.seconds.

  1. In the Visual Editor, add four text boxes, one for each number—days, hours, minutes, seconds—that will dynamically show the countdown values.
  2. In the Data tab > Code, click the Edit Content JS + CSS button. This opens the JavaScript and CSS editor for further customization.
  3. Within the Builder.isBrowser if statement, locate the existing code and update the finalDate variable to the Unix timestamp of the desired countdown end date. For example, to countdown to New Year's Day 2030, set finalDate to 1893456000000 (Unix timestamp of New Year's Day 2030).

The code should resemble this:

const second = 1000;
const minute = second * 60;
const hour = minute * 60;
const day = hour * 24;

state.days = "0";
state.hours = "0";
state.minutes = "0";
state.seconds = "0";

// New Year's Day 2030 - Unix time in milliseconds
let finalDate = 1893456000000;

const countDown = new Date(finalDate).getTime();
window.setInterval(myTimer, 1000);

function myTimer() {
   let now = new Date().getTime();
   let distance = countDown - now;
   state.days = Math.floor(distance / day);
   state.hours = Math.floor((distance % day) / hour);
   state.minutes = Math.floor((distance % hour) / minute);
   state.seconds = Math.floor((distance % minute) / second);

To get even more out of Templates with Builder, read Creating Templates.

Looking to hire a third party to help with your project?

Submit a project request and our partnerships team will reach out to connect you with an Expert from our partner ecosystem.

Connect with us

Was this article helpful?


Visual CMS

Theme Studio for Shopify

Sign up


Featured Integrations





Get In Touch

Chat With Us




© 2020, Inc.


Privacy Policy

Terms of Service

Get the latest from


Developer Newsletter

Latest tips, tricks, and news for frontend developers from our blog

Product Newsletter

Latest features and updates on the platform

By submitting, you agree to our Privacy Policy