systomic

Animated icon swap

When a copy button turns into a checkmark, a short crossfade tells you something happened. A hard cut reads as a glitch, or isn't noticed at all.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • WarningShows in the editor and in CI output, but doesn't fail the run (unless you pass --deny-warnings).

See the difference

Before
pnpm add -D systomic
{copied ? <CheckIcon /> : <CopyIcon />}
After
pnpm add -D systomic
<AnimatePresence mode="popLayout">…</AnimatePresence>

What doesn't work

2 findings

What works

No findings

Details

Reports a ternary that renders two icons as JSX children unless it is inside AnimatePresence, an animated wrapper or a motion.* element. Inside AnimatePresence, both icons need a key.

Option Default
iconSources lucide-react, @heroicons/react/*, @phosphor-icons/react, @radix-ui/react-icons, @tabler/icons-react, react-icons/*, @/icons
iconNamePattern ^[A-Z]…Icon$ or ^Icon[A-Z]…$
animatedWrappers ["AnimatePresence", "IconSwap"]
animatedElementPattern ^(motion|m)\.
checkAttributes false (also check icon={a ? <A /> : <B />})
Esc