🦄 mantine-scheme-transition 1.0.0: dark mode that starts where you click
Hey everyone 👋
A new extension joins the Mantine Extensions family today: mantine-scheme-transition 1.0.0.

What it does
Press the dark mode toggle and the new scheme spreads across the page from the button you pressed: a circle, a wipe, a curtain or a dissolve. It's built on the browser's View Transitions API, so the old and the new page are real snapshots, not a colour fade on every element.
import { SchemeToggle } from '@gfazioli/mantine-scheme-transition';
function Demo() {
return <SchemeToggle transition="circle" />;
}SchemeToggle takes ActionIcon's props (variant, color, radius), and its size is responsive. For a menu item, a hotkey or a SegmentedControl, the useColorSchemeTransition hook gives you toggle, setColorScheme and clearColorScheme with the same reveal.
The edges took longer than the animation
A keyboard press has no pointer, so the reveal starts from the toggle. prefers-reduced-motion gets an instant switch by default. forceColorScheme never starts a reveal. And browsers without view transitions just get Mantine's instant switch, no error.
The one that suprised me came up in review, before the release: three calls in the same tick (dark, light, dark) could end on light. My first fix waited on the pending update's promise, and it got one ordering right while breaking another.
A takeaway for your own code
When the browser already keeps a queue, use it instead of building your own next to it. The fix that held: a change with nothing to animate still goes through startViewTransition, and skips its own animation at once. The browser runs every update in call order, so the latest choice wins. I checked it in real Chromium and Firefox, not only in the tests.
I'd love your input
Would you use it in an app, or mostly on a docs site?
Which transition is missing? A diamond, blinds, something else?
Which extension should get some love next?
Drop a comment below, I read every one.
npm: https://www.npmjs.com/package/@gfazioli/mantine-scheme-transition
Docs: https://gfazioli.github.io/mantine-scheme-transition
GitHub: https://github.com/gfazioli/mantine-scheme-transition


p/meridian-16
p/runevr
p/pushary
p/faraday-4
p/clipjack
p/temp-mail-370
p/leantake
p/many-displays
p/producthunt
p/reso
p/kodlo
p/iphotron
p/comcent
p/htmldrag
p/relai-agent-eval-loop
p/neoagent
p/gatrends
p/beamfy
p/kanasensei
p/phanera
Replies
Be the first to reply
Have a question or a thought to share? Add a comment above to start the conversation.