Motion
How Momo moves: quick and plain, to show where something came from or that it answered. Two settings tune it, and it turns itself down for people who ask their device for less motion.
The two settings
| Setting | Value | What it does |
|---|---|---|
--momo-speed | 120ms | How long small changes take: hover colors, a pressed button, a focus ring |
--momo-ease | cubic-bezier(.2, .7, .3, 1) | The curve: fast at first, then settling |
Change them once and every small transition follows. Bigger moves have their own, slightly longer times (a dialog arriving, a drawer sliding, a section opening), and use the same curve.
Point at each one.
<div class="cluster" id="mo-demo">
<button class="btn" type="button">Normal (120ms)</button>
<button class="btn" type="button" style="--momo-speed: 500ms">Slow (500ms)</button>
<button class="btn" type="button" style="--momo-speed: 0ms">None (0ms)</button>
<span class="text-sm text-muted">Point at each one.</span>
</div>:root { --momo-speed: 200ms; } /* everything a little calmer */
.my-toolbar { --momo-speed: 0ms; } /* this part: no transitions */What moves, and how
| Part | Motion |
|---|---|
| Buttons, fields, links, tabs | Colors and outlines change over --momo-speed |
| Dialogs, menus, popovers | A short fade and a small move from where they open |
| Drawers, bottom sheets | Slide in from their edge; the backdrop fades |
| Collapse, accordion | The height (or the width) opens and closes |
| Toasts | Slide in, pile up, fan out when you point at them |
| Sortable, filter & sort, kanban | Items glide to their new places. A dragged item gets a shadow and is never tilted |
| Folder tabs | The box glides to the new panel's height while the panel fades in |
Classes for your own parts
All on Borders & effects. The short version:
transition(andtransition-colors,transition-opacity,transition-transform) withduration-150andease-momo.animate-spinandanimate-pulsefor waiting;animate-shakefor "that was wrong";animate-popfor "something arrived".transition-noneandanimate-noneswitch one element off.- Scroll in brings things in as they come into view.
Less motion
Some people get dizzy or distracted by movement and say so in their device's settings. Momo listens, with nothing for you to do:
--momo-speedbecomes 0, so small transitions are instant.- Slides, glides and fades are skipped or shortened: things appear in place.
- Spinners keep turning, slowly, because they carry meaning. Pulses, shakes and pops stop.
- Carousels do not play by themselves and jump between slides without sliding.
In your own CSS, wrap extra movement the same way:
@media (prefers-reduced-motion: no-preference) {
.my-banner { animation: slide-in .4s var(--momo-ease); }
}Three habits
- Move things to explain, not to decorate: where did this come from, where did that go.
- Keep it short. Something a person does fifty times a day should not take 300ms each time.
- Never make someone wait for an animation to finish before they can click.