1
Install the widget
Add the widget to your store via npm or a CDN script tag.
The CDN (UMD) build exposes a global
VirtualTryOn object on window. If you use a
bundler such as Vite or webpack, import the ESM build at dist/widget.mjs instead.2
Initialize the widget
Call
VirtualTryOn.init(options) once per page load to configure the widget with
your publishable key. Calling init() a second time is ignored.3
Add a Try-On button
Call
VirtualTryOn.createButton(options) once per product or garment. The button
renders into a container element you provide.In
"oc" (outfit combinator) mode, the garment is layered onto the user’s previous
completed try-on result — so the customer needs to have finished a try-on earlier in
the session before an outfit-combinator button can generate.Events and callbacks
The four callbacks you pass toinit() let you hook your own UI and analytics into the
try-on lifecycle. The widget stays lightweight and lets your page own the experience.
Full example
A complete, copy-paste product page with init, a button, and callbacks wired up:That’s it. When a customer clicks Try On, Souldi handles verification, the photo
upload, and AI generation — and the result appears right on your product page.
Next steps
Customization
Match the widget to your brand with theme modes, accent colors, fonts, and more.
Widget Overview
Learn how the widget works and how it keeps customer photos private.