Intermediate 12 min

Interactive Elements

Static pages are nice, but interactive pages are memorable. A visitor reads a static page and moves on. A visitor who fills out a form, watches a countdown tick, and sees content animate into view — that visitor engages.

In this lesson, you will build an event landing page with an RSVP form, a countdown timer, and scroll animations — all by describing what you want in plain English. You will not write a single line of JavaScript yourself. You will just explain the behavior, and Claude handles the rest.

The Event Page Project

Here is the project: a landing page for a local music festival called SoundWave 2026. The page needs four interactive features:

  • A hero section with the event name and a live countdown timer
  • A lineup section with artist cards that animate on scroll
  • An RSVP form that collects attendee information
  • Smooth hover effects that make the page feel polished

This is a realistic project — exactly the kind of thing a local venue, community group, or startup might need. Let us build it one feature at a time.

SoundWave 2026

July 15 — Riverside Amphitheater
127Days
08Hours
42Mins
15Secs
The ResonantsIndie Rock
Zara VoxElectronic
DriftwoodFolk

RSVP Now

Your Name
Email Address
Number of Tickets: 2
Reserve My Spot

That is the target. Now let us look at how you would prompt Claude to build each piece.

Forms — Collecting Information

Forms are how web pages collect information from visitors. A contact form, a signup form, a survey, an RSVP — they all follow the same pattern. Here is the prompt:

Terminal — Claude Code
you: Add an RSVP form with fields for name, email, and number of tickets (dropdown 1-4). When submitted, show a confirmation message. Style it to match the dark theme.
 
claude: I'll add the RSVP form with validation and a confirmation message.
 
Editing: index.html — adding form section
Editing: styles.css — dark-themed form styles
Editing: script.js — form submit handler
 
Done! The form:
- Validates email format before submitting
- Shows a "You're on the list!" confirmation
- Matches the dark color scheme

Claude generates the HTML form structure, the CSS styling, and the JavaScript that handles the submission. Here is what the form code looks like:

index.html
<form id="rsvp-form">
  <input type="text" name="name"
         placeholder="Your Name" required>

  <input type="email" name="email"
         placeholder="Email Address" required>

  <select name="tickets">
    <option value="1">1 Ticket</option>
    <option value="2">2 Tickets</option>
    <option value="3">3 Tickets</option>
    <option value="4">4 Tickets</option>
  </select>

  <button type="submit">Reserve My Spot</button>
</form>

The key concept: a form is just a way to collect information. Each input field has a type (text, email, number, dropdown) and a name. When the user clicks submit, something happens — a message appears, data gets sent somewhere, or the page updates. You describe the fields you need and what should happen on submit; Claude writes the implementation.

Animations & Transitions

Animations are what make a page feel alive. Cards that slide into view, buttons that lift on hover, sections that fade in as you scroll — these small touches separate a flat page from a polished experience. Here is the prompt:

Terminal — Claude Code
you: Add a fade-in-up animation to the artist cards — they should be invisible and slide up into view as the user scrolls down. Add a smooth hover effect on the cards where they lift up with a shadow.
 
claude: I'll add scroll-triggered animations and hover effects to the artist cards.
 
Editing: styles.css — fade-in keyframes, hover transforms
Editing: script.js — IntersectionObserver for scroll detection

You do not need to know CSS animation syntax. Describe the motion you want, and Claude translates it to code. Here are common animation descriptions and what they produce:

Fade In Up

"Fade in and slide up as the user scrolls"

Element starts invisible and 20px below its final position, then glides up while becoming visible. Classic for cards, paragraphs, and images.

Scale on Hover

"Grow slightly larger when hovered"

Element scales to 105–110% on hover with a smooth transition. Works well on cards, buttons, and thumbnails.

Lift with Shadow

"Lift up with a deeper shadow on hover"

Element moves up a few pixels and gains a larger box-shadow, creating a "floating" effect. Great for clickable cards.

Pulse Effect

"Add a subtle pulse to draw attention"

Element gently scales up and down on a loop. Use sparingly — good for notification badges or call-to-action buttons.

The pattern is always the same: describe the visual motion in plain language, and Claude picks the right CSS properties (transform, opacity, transition, @keyframes) to make it happen.

Countdown Timers

A countdown timer adds urgency and excitement. It is one of the most common interactive features on event pages, product launches, and coming-soon sites. Here is the prompt:

Terminal — Claude Code
you: Add a countdown timer to the hero section that counts down to July 15, 2026. Show days, hours, minutes, and seconds. Style it with large numbers in a row.
 
claude: I'll add a countdown timer with days, hours, minutes, and seconds.
 
Editing: index.html — countdown container in hero
Editing: styles.css — countdown block styling
Editing: script.js — timer logic with setInterval
 
The timer updates every second and shows "Event Started!"
when the countdown reaches zero.

Here is what is happening behind the scenes: JavaScript checks the current time, calculates the difference to the target date (July 15, 2026), and breaks that difference into days, hours, minutes, and seconds. Then it updates the display. Every single second, it recalculates. You described the feature in one sentence; Claude handled all the math and timing logic.

Event-Based Thinking

There is one mental model that makes all of interactivity click: "When something happens, do something else." Every interactive feature on any website follows this pattern. Once you start thinking in When/Then pairs, you can describe any behavior to Claude:

  • When the user scrolls down fade in the artist cards
  • When the form is submitted show a thank-you message
  • When the countdown reaches zero display "Event Started!"
  • When a card is hovered lift it up with a shadow
  • When the user clicks a menu button slide open the navigation panel
  • When a required field is left empty show a red error message

This is the only programming concept in vibe coding that is genuinely worth understanding. You do not need to learn JavaScript syntax, DOM manipulation, or event listeners. You just need to think: "When [trigger], then [response]." Claude translates that into working code every time.

The more specific your When/Then descriptions, the better the result. "When the user hovers over a card, lift it 4px and add a soft shadow" is much better than "make the cards interactive."

Pro Tip

Test your interactive elements on both desktop and mobile. Touch screens do not have hover effects, so anything triggered by hover needs a tap alternative. Ask Claude: "Make sure the hover effects also work on mobile with tap." This one sentence prevents a whole category of mobile usability problems.

Try This

Build your own event page — a birthday party, a workshop, a game night, a product launch. Include at least: a countdown timer to the event date, a form with 3 or more fields, and one scroll animation. See how far you can get with just natural language descriptions.

A Live Demo

Theory is fine, but nothing beats seeing it work. Below is a real, working countdown timer built right into this lesson page. It counts down to July 15, 2026 — the date of our fictional SoundWave festival. Here is the code that powers it:

countdown.js
const target = new Date('2026-07-15T18:00:00').getTime();

function updateCountdown() {
  const now = Date.now();
  const diff = target - now;

  if (diff <= 0) {
    // When countdown reaches zero, show message
    document.getElementById('live-cd').innerHTML =
      '<p style="color:#e2b340">Event Started!</p>';
    return;
  }

  const days  = Math.floor(diff / 86400000);
  const hours = Math.floor((diff % 86400000) / 3600000);
  const mins  = Math.floor((diff % 3600000) / 60000);
  const secs  = Math.floor((diff % 60000) / 1000);

  document.getElementById('cd-days').textContent  = days;
  document.getElementById('cd-hours').textContent
    = String(hours).padStart(2, '0');
  document.getElementById('cd-mins').textContent
    = String(mins).padStart(2, '0');
  document.getElementById('cd-secs').textContent
    = String(secs).padStart(2, '0');
}

updateCountdown();
setInterval(updateCountdown, 1000);

And here it is, running live right now:

-- Days
-- Hours
-- Mins
-- Secs

Those numbers are updating every second. You described "a countdown timer to July 15, 2026 with days, hours, minutes, seconds in large blocks" — and that is exactly what Claude built. The JavaScript calculates the time remaining, formats it, and updates the page. All from a single sentence of instruction.

Quick Check

1. What is the "When / Then" pattern?

A A JavaScript library for building timers
B When an event happens, trigger an action in response
C A CSS technique for creating animations
D A way to structure HTML forms

2. How do you ask Claude for a scroll animation?

A Write the CSS @keyframes code and ask Claude to fix it
B Install an animation library first, then reference it
C Describe the motion: "fade in and slide up as the user scrolls"
D Use the built-in HTML animation attribute

3. Why should you test interactive elements on mobile?

A Touch screens do not have hover, so hover effects need a tap alternative
B Mobile browsers cannot run JavaScript
C Forms do not work on mobile devices
D Countdown timers run slower on phones

Key Takeaways

  • Forms collect information from visitors. Describe the fields you need and what happens on submit — Claude handles validation and styling.
  • Animations bring pages to life. Describe the motion in plain language ("fade in up on scroll," "lift with shadow on hover") and Claude writes the CSS and JavaScript.
  • Countdown timers add urgency and excitement. Specify the target date and the display format — Claude handles the math and the per-second updates.
  • All interactivity follows the When/Then pattern: when a trigger occurs, a response happens. This mental model lets you describe any behavior.
  • Always test on mobile. Hover effects need tap alternatives, and forms should be usable on small screens.
  • You do not need to learn JavaScript, CSS animations, or event listeners. You need to clearly describe the behavior you want.