Skip to main content

Expivi SDK tutorials

These tutorials show how to integrate an Expivi product configurator in your own web page, such as a webshop product page or a B2B portal, with the Expivi SDK (@expivi/sdk). You start with the product visualization and its options, then add a live price, live specifications, the bill of materials, a request-quote button, and saving and restoring configurations.

Every tutorial has code for plain JavaScript, Vue and React. Pick your stack in any code tab, and the other tabs on the site follow.

tip

For the full API of the SDK, see the Expivi SDK reference. These tutorials focus on putting it together in a web page.

The example repository​

All code in these tutorials comes from the sdk-tutorials repository. It contains three standalone example apps, one per stack, with the same demo pages:

Demo pageTutorial
index.html: the product visualization and its optionsAdd Expivi to a web page
theming.html: the Expivi components in a custom brand themeStyle and theme the UI
price.html: a live price and the price breakdownShow the price
specifications.html: a live summary of the selected optionsShow live specifications
bom.html: the bill of materialsShow the bill of materials
request-quote.html: a request-quote button and formAdd a request-quote button
save-and-share.html: saving, restoring and sharing configurationsSave and restore configurations
product-page.html: everything combined into a webshop product page

To run the examples, clone the repository, then:

npm install
cp examples/vanilla/.env.example examples/vanilla/.env # fill in your API token and product ID
npm run dev:vanilla # or dev:vue / dev:react

How an integration fits together​

An Expivi integration has four parts:

  • The 3D viewer. A script from Expivi's CDN that renders 3D products. The SDK uses it through window.expivi.
  • The ProductConfigurator. The core of the SDK. It loads the product from the Expivi API, holds the configuration, applies the product rules and calculates prices. You create one per product page.
  • Web components. Ready-made UI elements, such as <xpv-product-visualizer> and <xpv-layout-composer>, that render the product and its options from the configurator. They are standard custom elements, so they work in any framework and without one.
  • The theme. A stylesheet that styles the web components. You can adjust it to your brand or replace it.

For UI that the web components don't cover, the SDK has use… functions (hooks) that read and change the configurator state, such as usePriceBreakdown for the price. The tutorials use them to build a custom price box, a specifications list and a BOM table.

Prerequisites​

  • An Expivi API token and the ID of a product to configure.
  • Node.js 22 or newer and npm 10 or newer.
  • A bundler. The tutorials use Vite, but any bundler that supports ES modules works.
  • For some tutorials, features set up for the product in Expivi: prices, a bill of materials or a quote request form. Each tutorial lists what it needs.

Browser support​

The 3D viewer needs WebGL. See browser support for the supported browsers.