🦄 mantine-border-animate 3.1.0 — a border that knows when to stop
Hey everyone 👋
mantine-border-animate 3.1.0 is out, and it's a release about endings.
What changed.
Finite laps. iterations={2} runs the border twice and stops exactly where the last lap ends; onComplete tells you when. A border can now mark an event — a job that started, a save that went through — and then step aside.
Free while off-screen. A border scrolled out of view pauses, and when it comes back it catches up on the time it missed.
Reduced motion, per component. respectReducedMotion keeps a border still for people who ask their system for less motion, whatever the theme says.
A multicolour comet (colorStops now colour its tail) and a smoother wedge that fades in and out with no visible edge.
The why. I compared the component with border-beam-ios, a native port of the same effect, and two things stood out: it stops drawing when nothing is on screen, and it treats the beam as something that can finish. Status UIs need that more than an endless loop.
The takeaway. Browsers don't pause CSS animations you can't see. I measured it in Chrome: a dozen off-screen rings kept recalculating styles on every frame, up to 1.4 s of main-thread time every 10 s. Pausing them is easy; the catch is that a paused animation falls out of step with its neighbours. So on the way back each animation's currentTime moves forward by the time it spent paused, and it lands where it would have been. One more small trick: under reduced motion the animations get zero length instead of being removed, because a zero-length animation still fires animationend, so onComplete never leaves your code waiting.
No breaking change: the defaults behave as before.
I'd love to hear from you:
Would you use a border as a status signal (running, done), or is it pure decoration for you?
Do you respect prefers-reduced-motion in your own animations, globally or per component?
When a border is done, what should it do: stay, fade, or disappear?
Drop a comment below 🙏
📦 npm: https://www.npmjs.com/package/@gfazioli/mantine-border-animate
📖 Docs: https://gfazioli.github.io/mantine-border-animate
💻 GitHub: https://github.com/gfazioli/mantine-border-animate


p/reso
p/zush
p/meridian-16
p/producthunt
p/google-cloud-platform
p/kodlo
p/beamfy
p/netclicker
p/faraday-4
p/neoagent
p/expert-chase-deleted-1107920
p/runevr
p/gatrends
p/kanbanq
p/truedraft-cad
p/findergit
p/thebold
p/orbit-app-blocker
p/cleared-quit-nicotine
p/lancetta
Replies
Be the first to reply
Have a question or a thought to share? Add a comment above to start the conversation.