Skip to main content

ViewFX

v0.0.8

31+ ready-to-use theme transitions for Tailwind CSS. Zero config, one class on <html>.

Open Playground

npm install viewfx

@import 'tailwindcss';
@import 'viewfx';

Frequently Asked Questions

Everything you need to know about the ViewFX Tailwind plugin.

What is ViewFX?

ViewFX is a Tailwind CSS plugin for theme toggles. It ships 31 dark/light transitions on the native View Transitions API. Put one class on <html> and wrap your theme toggle in document.startViewTransition — no custom keyframes required.

How do I install it?

Run pnpm add viewfx (or npm / yarn / bun), then add @import 'tailwindcss'; and @import 'viewfx'; to your global CSS for Tailwind v4.

Does it work with Tailwind CSS v3 and v4?

Yes. Tailwind v4 uses the CSS import. Tailwind v3 registers the same utilities with plugins: [require("viewfx")] in tailwind.config.js.

How do I use an effect class?

Add a class such as circle, fade, or polygon to <html>. Timing can share that class (circle-duration-1000-delay-300) or use fx-duration-*, fx-delay-*, and fx-steps-*. The theme class is expected to be .dark on the same element.

Does the plugin toggle light and dark mode by itself?

No. You still toggle the .dark class. ViewFX only styles the view-transition snapshots between the two themes. Browsers without the API skip the animation and switch instantly.

What happens with reduced motion?

prefers-reduced-motion: reduce turns off the wipe. The theme still changes; the motion does not run.

Is it free and open source?

Yes. The project is MIT licensed, free to use commercially, and open for contributions on GitHub at luisitoluis/viewfx.