Web design techniques
Micro-interactions in web design
Micro-interactions are the small, single-purpose moments of feedback in an interface: a heart that pops when you like something, a switch that slides, a button that shows it’s saving, a field that tells you what’s wrong as you type. They’re not a style but a technique that works with any style. Done well, they make a site feel responsive and trustworthy. Done badly, they’re slow, bouncy and easy to miss.
A live example
These four examples are live. Click the heart, the switch and the save button, and try typing something that isn’t an email. Then switch to the common mistake and try them again.
Like
The heart pops and the count changes, so you know it worked.
Toggle
The knob slides, the colour changes and the label says the state in words.
Save
Field
Enter an email address in the format you@example.com.
Type something that isn’t an email, then click away.
Done well: every action gets quick feedback in under 200 milliseconds, the switch says its state in words as well as colour, saving shows progress and then confirms, and the field explains how to fix the error.
What makes a good micro-interaction
A trigger
Something the person does, such as a click, a tap or typing, or something the system does, such as finishing a save.
onClick, :user-invalidQuick feedback
A change that shows the action worked, ideally within 100 to 200 milliseconds.
transition: 150msMore than colour
State shown with words, icons or position as well as colour, so everyone can see it.
aria-checkedA clear end
The interaction finishes and settles, rather than looping or bouncing.
animation: 180ms 1The CSS
Each of these is a few lines of CSS. The pattern is the same every time: a short transition, a clear end state, and a reduced-motion rule that keeps the feedback while removing the movement.
/* A like button that pops once */
.like.is-on .heart path { fill: #c2185b; stroke: #c2185b; }
.like.is-on .heart { animation: pop 180ms ease-out; }
@keyframes pop { 50% { transform: scale(1.3); } }
/* A switch that slides and says its state */
.switch {
position: relative;
display: inline-flex;
align-items: center;
gap: 10px;
}
.switch::before {
content: "";
flex: none;
width: 48px; height: 28px;
border-radius: 999px;
background: #8a8983;
transition: background-color 150ms;
}
.switch .knob {
position: absolute;
left: 3px; top: 50%;
width: 22px; height: 22px;
margin-top: -11px;
border-radius: 50%;
background: #ffffff;
transition: transform 150ms ease-out;
}
.switch[aria-checked="true"]::before { background: #1b5e3e; }
.switch[aria-checked="true"] .knob { transform: translateX(20px); }
/* A field that only complains after someone has tried */
.error { display: none; }
.input:user-invalid { border: 2px solid #a8102b; }
.input:user-invalid + .error { display: block; }
/* Keep the feedback, lose the movement */
@media (prefers-reduced-motion: reduce) {
.like.is-on .heart { animation: none; }
.switch::before, .switch .knob { transition: none; }
}Tuning the values
| Property | A good starting range | What goes wrong outside it |
|---|---|---|
| Duration | 100ms to 250ms | Slower and people wait for the interface. Faster and they miss the feedback. |
| Easing | ease-out for most things | Springy, overshooting curves feel playful once and annoying every time after. |
| Repeats | Once | Animations that loop or repeat draw attention away from the task. |
| Loading states | After about 300ms | Show a spinner or progress only if the wait is long enough to notice. |
When it works
- Buttons, toggles, forms and anything people click often.
- Saving, sending and uploading, where people need to know it worked.
- Small moments of brand personality, such as a playful like button.
When to avoid it
- Decoration that isn’t tied to an action.
- Long or looping animations on things people use all day.
- Feedback that only works with a mouse, such as hover-only states.
How they work
The four parts of a micro-interaction
Designer Dan Saffer described micro-interactions as having four parts. Thinking in those terms makes it easier to design and review them consistently.
Trigger
What starts it: a click, a tap, typing, or something happening in the background.
Rules
What happens next, and in what order. For example, save, then show progress, then confirm.
Feedback
What people see, hear or feel. This is the part most often missing.
Loops and modes
What happens if it’s repeated, or if something goes wrong.
What to check when you review a site’s micro-interactions
Micro-interactions are small, so they’re easy to skip in a review. These are the checks that catch most problems.
button1. Feedback on every action
Click every button and toggle. Check something visibly changes straight away.
[role=switch]2. State in words, not just colour
Check toggles and selected states also change a label, an icon or a position.
.is-saving3. Loading and saving
Check slow actions show progress, and then confirm when they’re done.
[role=status]4. Screen reader announcements
Check confirmations such as "Saved" are announced, using a status region.
.input:user-invalid5. Form errors
Check errors appear after someone has tried, and say how to fix the problem.
transition6. Speed
Check animations finish in about 250ms or less, so nothing makes people wait.
@media (prefers-reduced-motion)7. Reduced motion
Check movement stops for people who prefer reduced motion, while the feedback stays.
:hover8. Touch screens
Check nothing important only happens on hover, since phones and tablets have no hover.
Reviewing with clients
Notes on exactly which button didn’t respond
"I clicked it and nothing happened" is one of the most common bits of client feedback, and one of the hardest to act on without knowing which button and which device. With ClickNote, clients click directly on elements of the website and leave a note, without creating an account or installing a browser extension.
Send your client a review link for the page.
They click the button that didn’t respond and say what they expected to happen.
You get the selector, a screenshot and their device, so you can go straight to the right rule in your CSS.
I clicked this and nothing seemed to happen. Did it work?
mobile · Safari on iPhone - 390 x 844
.mi-saveReviewing a site in one of these styles?
Send your client a review link and they can click directly on elements of the website and leave a note, without creating an account or installing a browser extension. You get the selector, a screenshot and their device with every note.
14-day free trial. No card needed. See pricing.