Skip to Content
New: codec-png-native and codec-png-wasm bring the blazediff-png codec to Node and WebAssembly, faster than spng and jSquash. Read more β†’
DocsIn a UIVanilla JavaScript

Vanilla Components

@blazediff/ui gives you the same four comparison modes as the React package, mounted into any DOM node. Each demo below is the real thing, running in this page.

Every mount* call returns a { update, destroy } handle: update(options) swaps sources or options in place, destroy() tears the UI down. Underneath sits a headless engine you can drive directly from Vue, Svelte, Solid or your own renderer, which is what the React package does.

Installation

npm install @blazediff/ui
import { mountSwipe } from "@blazediff/ui"; // A draggable divider over two stacked images. position is 0 to 100. const handle = mountSwipe(document.getElementById("app"), { src1: "before.png", src2: "after.png", onPositionChange: (position) => console.log(position), });

Next

Last updated on