Deft
Ask AI

Search

Search skills, authors and topics

Jakubantalik / transitions.dev

transitions-dev

Production-ready CSS transitions for web apps. Use when implementing notification badges, dropdowns, modals, panel reveals, page transitions, card resizes, number pop-ins, text swaps, icon swaps, success checks, avatar group hovers, error state shakes, search/input clear, skeleton loaders, shimmer text, sliding tabs, tooltips, staggered text reveals, card hover tilt, plus-to-menu morph, accordions, toasts, like buttons, learn-more hovers, checkbox checks, spinning counters, toggles, AI thinking states, reasoning streams, streaming text, matrix dot loaders, or banner stacking. Triggers on "add a transition", "animate the dropdown", "make the modal open smoothly", "swap icon", "page slide", "stagger animation", "open / close transition", "make it animate", "fade between", "success animation", "form error", "shake on invalid", "hover lift", "avatar stack hover", "clear the search", "skeleton loader", "loading shimmer", "shimmer text", "sliding tabs", "segmented control", "tooltip", "reveal text", "tilt card", "3D hover tilt", "cursor glare", "plus to menu", "FAB morph", "accordion", "collapsible", "expand / collapse", "disclosure", "toast", "snackbar", "like button", "heart animation", "learn more arrow", "checkbox", "check animation", "spinning counter", "odometer", "slot machine digits", "toggle", "switch", "thinking states", "AI status line", "agent reasoning", "reasoning stream", "streaming text", "stream words in", "matrix loader", "dot loader", "banner stack", "stacked toasts". Also "motion tokens", "scan for ad-hoc transitions", "replace hardcoded durations with motion tokens", "tokenize my animations", and the commands transitions reveal, transitions review, transitions apply, transitions refine.

Install

npx skills add https://github.com/Jakubantalik/transitions.dev --skill transitions-dev

Text states swap

When to use

Swapping the text of a status indicator in place — "Processing…" → "Done", "Save" → "Saved". The old text exits up with blur, the new text enters from below.

HTML usage

html
<span class="t-text-swap">Processing…</span>

Driven by JS (three-phase sequence):

  1. Add .is-exit -> old text slides up + blurs + fades.
  2. After --text-swap-dur: change textContent, then add .is-enter-start (jumps to below, no transition).
  3. Force reflow, remove .is-enter-start so the new text animates back to 0 with the default transition.

Tunable variables

VariableDefaultNotes
--text-swap-dur150mssourced from --p6-dur
--text-swap-translate-y4pxsourced from --p6-translate-y
--text-swap-blur2pxsourced from --p6-blur
--text-swap-easeease-in-outsourced from --p6-ease

The :root defaults below match the live tuning on transitions.dev. Drop them into your global stylesheet once — every transition in this skill reads from semantic names like these, so multiple transitions can share a single :root block.

css
:root {  --text-swap-dur: 150ms;  --text-swap-translate-y: 4px;  --text-swap-blur: 2px;  --text-swap-ease: ease-in-out;}

CSS

css
.t-text-swap {  display: inline-block;  transform: translateY(0);  filter: blur(0);  opacity: 1;  transition:    transform var(--text-swap-dur) var(--text-swap-ease),    filter    var(--text-swap-dur) var(--text-swap-ease),    opacity   var(--text-swap-dur) var(--text-swap-ease);  will-change: transform, filter, opacity;}.t-text-swap.is-exit {  transform: translateY(calc(var(--text-swap-translate-y) * -1));  filter: blur(var(--text-swap-blur));  opacity: 0;}.t-text-swap.is-enter-start {  transform: translateY(var(--text-swap-translate-y));  filter: blur(var(--text-swap-blur));  opacity: 0;  transition: none;}
@media (prefers-reduced-motion: reduce) {  .t-text-swap { transition: none !important; }}

The @media (prefers-reduced-motion: reduce) guard at the bottom of the snippet is required — keep it. It zeroes the transition for users who have asked for less motion at the OS level.

JavaScript orchestration

js
// Three-phase text swap://   1. Add .is-exit              — old text exits up with blur.//   2. After --text-swap-dur, swap textContent and add .is-enter-start//      (jumps to "below, no transition"), force a reflow.//   3. Remove .is-enter-start    — new text animates back to rest.const el = document.querySelector(".t-text-swap");const dur = parseFloat(  getComputedStyle(document.documentElement).getPropertyValue("--text-swap-dur")) || 200;
function swapText(next) {  el.classList.add("is-exit");  setTimeout(() => {    el.textContent = next;    el.classList.remove("is-exit");    el.classList.add("is-enter-start");    void el.offsetHeight; // force reflow so the next change transitions    el.classList.remove("is-enter-start");  }, dur);}