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/uiswipe-mode
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
- Using React? The React components wrap these
- Every option and the engine API:
@blazediff/uireference
Last updated on