Day 9 of 28 Β· Vibe Coding Challenge
Adding Interactivity
β± 7 min
π Beginner
A static page is like a poster. It looks nice, but nobody can do anything with it. Today you turn your projects into things people can actually use β forms that submit, buttons that do things, content that responds to user actions.
What is interactivity?
Interactivity is anything that responds to a user's actions:
Click a button β something happens (a modal opens, data saves, a page changes)
Type in a form β validation appears, characters count, suggestions show up
Scroll the page β animations trigger, sections reveal, a progress bar fills
Hover over an element β it transforms, shows info, highlights
Toggle a switch β dark mode activates, a setting saves, content filters
The difference between a "website" and a "web app" is interactivity. Today you cross that line.
Knowledge Check
What turns a static webpage into an interactive web application?
A
Adding more text content
C
Elements that respond to user actions β clicks, typing, scrolling, and other interactions
D
Using more CSS animations
Interactivity means the page responds to what the user does. A blog post is static β it looks the same for everyone. A to-do app is interactive β users add, check off, and delete items. The page changes based on user actions.
Forms that actually work
Forms are the most common interactive element. Let's build one that does real validation.
Add a contact form to my landing page with these fields: name, email, message. Add real-time validation β name must be at least 2 characters, email must be valid format, message must be at least 10 characters. Show inline error messages in red below each field. Disable the submit button until all fields are valid. Show a success toast notification when submitted.
Contact form added β
π Three fields: name, email, message
β
Real-time validation as the user types:
- Name: "Must be at least 2 characters"
- Email: "Please enter a valid email"
- Message: "Must be at least 10 characters"
π΄ Red error messages appear below invalid fields
π Submit button stays disabled (grayed out) until all fields pass
π Success toast slides in from the top when form submits
Try filling out the form β validation triggers as you type.
β» Replay conversation
Real-time validation in action β errors appear as you type, not after you submit.
Knowledge Check
Why is real-time validation better than showing errors only after clicking submit?
A
It's a technical requirement for forms
B
It makes the form load faster
C
Users get immediate feedback and can fix issues as they type, instead of getting surprised after filling everything out
Real-time validation reduces frustration. Nobody likes filling out an entire form, clicking submit, and then being told their email was wrong. Instant feedback keeps users moving forward confidently.
Modals and popups
Modals are overlays that appear on top of the page β login forms, confirmations, image galleries, and more.
Add a "Sign Up" button to the hero section. When clicked, it opens a modal with a sign-up form (name, email, password). The modal should have a blurred background overlay, smooth open/close animation, and close when clicking outside it or pressing Escape. Add a "Already have an account? Log in" link at the bottom of the modal.
Sign-up modal added β
π΅ "Sign Up" button in hero section
π¦ Modal with:
- Name, email, password fields
- Blurred background overlay
- Fade + scale animation on open/close
- Closes on overlay click or Escape key
- "Already have an account? Log in" link
β¨ Smooth animations throughout. Try clicking the button!
β» Replay conversation
Dark mode toggle
Everyone expects dark mode now. It's also a perfect example of a toggle interaction.
Add a dark mode toggle to the navigation bar. Use a sun/moon icon that switches. The toggle should remember the user's preference (persist across page refreshes). Transition smoothly between light and dark themes β don't flash.
Dark mode added β
π Moon icon in nav bar (switches to βοΈ sun in dark mode)
πΎ Preference saved in localStorage β persists across refreshes
π¨ Smooth 300ms transition on all colors
β‘ No flash on page load β checks saved preference before rendering
Everything adapts: backgrounds, text, cards, borders, and form inputs.
β» Replay conversation
One prompt adds dark mode β toggle, persistence, smooth transition.
The footer looks weird in dark mode β the links are hard to read.
Fixed β Footer links now use a lighter gray (#A1A1AA) in dark mode with improved contrast. Hover state changes to white for clarity.
β» Replay conversation
Knowledge Check
Why should a dark mode toggle "remember the user's preference"?
A
To comply with accessibility laws
C
So users don't have to toggle it again every time they visit β their choice persists across sessions
D
To make the code more complex
Persistence is about respecting the user's choice. If someone prefers dark mode, they shouldn't have to toggle it every time they visit your site. localStorage keeps that preference saved in their browser.
Animations and micro-interactions
Subtle animations make your project feel polished and professional. Here are the most impactful ones:
Scroll animations β Sections fade or slide in as you scroll down
Hover effects β Cards lift up, buttons change color, images zoom slightly
Loading states β Spinners, skeleton screens, progress bars while content loads
Transitions β Smooth changes between states instead of instant jumps
Add these micro-interactions to my landing page:
1. Feature cards slide up and fade in when they enter the viewport
2. Numbers in the stats section count up from 0 when visible
3. The hero headline types itself out letter by letter
4. CTA buttons have a subtle scale effect on hover
Micro-interactions added β
π¦ Feature cards β slide up + fade in on scroll (staggered timing)
π’ Stats counter β numbers count up from 0 when section is visible
β¨οΈ Hero typewriter β headline types out letter by letter on page load
π CTA buttons β scale to 1.05x on hover with smooth transition
The page feels alive now. Smooth and professional.
β» Replay conversation
Knowledge Check
Which type of animation has the biggest impact on making a page feel professional?
A
Auto-playing video backgrounds
C
Subtle micro-interactions β smooth transitions, gentle hover effects, and fade-in reveals
D
Flashy, attention-grabbing animations
The best animations are felt, not noticed. Subtle transitions, gentle hover effects, and smooth reveal animations make a page feel polished without being distracting. Professional sites use restraint β every animation should serve a purpose.
Your turn
Take the landing page you built yesterday (or any project) and add at least three interactive elements:
1. A form with real-time validation
2. A toggle (dark mode, or anything that switches between two states)
3. Scroll-triggered animations
Each one teaches you a different interaction pattern. By the end, your page will feel like a real product.
Final Check
What turns a website from "nice looking" to "feels professional"?
A
Thoughtful interactivity β smooth animations, responsive forms, persistent user preferences
Interactivity is the difference between a poster and a product. When forms validate in real-time, dark mode remembers your preference, and sections animate smoothly into view β that's when a page stops being a website and starts being an experience.
β¨
Day 9 Complete
"A page that responds to you isn't a page β it's an experience. Now you know how to build one."
Tomorrow β Day 10
Working with APIs
Your apps will learn to talk to the outside world β pulling live data from real services and APIs.