Presets

Micro interactions examples

4 presets. Open one to tune it and copy the code.

01 Toggle switch toggle
02 Animated checkbox toggle
03 Like button toggle
04 Scroll down indicator loop

Micro interactions are small animations that respond to a single user action and confirm it happened. This collection covers the ones designers ask for most. The Toggle switch slides its knob across with a slight spring while the track changes color. The Animated checkbox fills its box and then draws the check mark with a stroke-dashoffset transition. The Like button pops a heart, fills it and fires a ring burst, Twitter style. The Scroll down indicator animates a mouse wheel to hint at content below the fold.

The toggle, checkbox and like button are built on a real hidden checkbox, styled with :has(:checked), so they work without JavaScript, submit with forms and respond to the keyboard.

Tune sizes, colors and timing live, then copy CSS, Tailwind (has-[:checked]: variants) or a React component with Motion and useState.

What makes a good micro interaction?

It responds to one action, finishes quickly (usually 0.2 to 0.5 seconds), and tells the user something: the setting is on, the item is saved, the post is liked. It should never block the next action. If removing the animation would make the state unclear, it is doing its job; if not, it may be decoration.

Why are the toggle and checkbox built on a real checkbox?

A native input gives you focus, keyboard toggling with Space, form submission and screen reader state for free. The visual parts are styled from the input's checked state with :has(:checked). Rebuilding all of that with divs and JavaScript is more code and usually ends up less accessible.

Can I use these micro interactions in React?

Yes. The React tab outputs a component that keeps the checked state in useState, renders the same hidden input, and animates with Motion from motion/react. You can lift the state up to a prop to make it a controlled component, which fits forms and settings pages built with React.