Skip to main content

AutoViz SDK Integration Guide

Overview

Create custom HTML/CSS buttons for launching AutoViz tools; SDK handles tool launching via data-params.

Quick Start

  1. Add the AutoViz SDK script to your page:
<script src="https://sdk-v2.autoviz.io" defer></script>

The defer attribute ensures the script loads without blocking page rendering and executes after the DOM is ready.

  1. Create an element with class="autoviz" and data attributes:
<button class="autoviz my-button-class"
data-tool="viewer"
data-group="super-model-series-x"
data-select-field="finish_name"
data-select-current="gloss-black"
data-display-mode="fullscreen"
data-fullscreen-avoid="#header">
VIEW IN 3D
</button>
  1. Style with your own CSS—the SDK won't modify your HTML.

SDK NPM Package

For React applications, you can use our NPM package instead of manually adding script tags. The NPM package provides a React component that automatically loads the SDK script and converts props to data attributes.

Installation

npm install @autoviz/sdk

Usage

import { AutoViz } from '@autoviz/sdk';

function MyComponent() {
return (
<AutoViz
tool="viewer"
group="super-model-series-x"
selectField="finish_name"
selectCurrent="gloss-black"
displayMode="fullscreen"
fullscreenAvoid="#header"
>
<button className="my-button-class">
VIEW IN 3D
</button>
</AutoViz>
);
}

Features:

  • ✅ Automatic SDK script loading
  • ✅ TypeScript support with full type definitions
  • ✅ All SDK data attributes available as props
  • ✅ Works with any React framework (Next.js, Vite, etc.)

📦 View full NPM package documentation →

Data Attributes

Core Attributes

AttributeTypeRequiredDescriptionExample
data-toolstringYesTool to launch (viewer, configurator, sims, arto, catalog)data-tool="viewer"
data-part-idnumberOptionalAutoViz part IDdata-part-id="12345"
data-variant-idnumberOptionalSpecific variant IDdata-variant-id="67890"
data-groupstringOptionalProduct group identifier for selectionsdata-group="series-z"
data-select-fieldstringOptionalField name for selectionsdata-select-field="finish_name"
data-select-currentstringOptionalCurrent selection valuedata-select-current="chrome"

Optional UI Customization Attributes

AttributeTypeDescriptionExample
data-display-modestringOptionalDisplay mode (modal, fullscreen, fillparent)
data-fullscreen-avoidstringOptionalCSS selector to avoid overlapping
data-themestringUI theme preferencedata-theme="dark"
data-theme-togglestringShow theme toggle buttondata-theme-toggle="0"
data-backgroundstringShow background, set to 0 for transparencydata-background="1"
data-primary-colorstringPrimary UI color (hex without #)data-primary-color="FF0000"
data-hide-navstringHide navigation controlsdata-hide-nav="1"
data-hide-closestringHide close buttondata-hide-close="1"
data-config-buttonstringShow configurator button in viewerdata-config-button="1"

Part Specification Attributes [beta]

Use data-spec-{name} attributes to pass wheel sizing and fitment data. See Part Specification for full documentation.

<button class="autoviz"
data-tool="configurator"
data-spec-front-wheel="?diameter=22&width=10&offset=25"
data-spec-rear-wheel="?diameter=22&width=12&offset=30">
Configure Wheels
</button>

Setting specific data-part-id and/or data-variant-id takes precedence over data-group and data-select- selections.

Valid Tool Values

Tool ValueDescription
viewer3D Viewer
configuratorConfigurator
simsSee In My Space
artoAR Try-On
catalogCatalog browser

Valid Mode Values

ModeDescription
modalOpens in modal dialog (default)
fullscreenOpens in fullscreen overlay
fillparentFills parent container

Preventing Button Flash (FOUC)

The SDK validates that 3D models exist before showing buttons. To prevent buttons from flashing before validation completes, pre-hide them using one of these methods.

Important: The SDK uses visibility and opacity for showing/hiding, not display. Do not use display: none as the SDK cannot override it.

Hide .autoviz elements using visibility which the SDK can override:

<style>
.autoviz {
visibility: hidden;
opacity: 0;
}
/* SDK adds autoviz-visible class which overrides these */
</style>

Method 2: Inline Style

Add inline visibility styles:

<button class="autoviz my-button"
style="visibility: hidden; opacity: 0;"
data-tool="viewer"
data-group="my-wheel">
View in 3D
</button>

Method 3: SDK Hidden Class

Use the SDK's built-in hidden class:

<button class="autoviz autoviz-hidden my-button"
data-tool="viewer"
data-group="my-wheel">
View in 3D
</button>

SDK Visibility Classes:

ClassDescription
autoviz-hiddenElement is hidden (height: 0, opacity: 0, visibility: hidden)
autoviz-visibleElement is visible (opacity: 1, visibility: visible)
autoviz-disabledElement is dimmed and non-interactive

Do NOT use:

/* This will NOT work - SDK cannot override display */
.autoviz { display: none; }

Complete Examples

Example 1: Minimal Button

<button class="autoviz my-button-class"
data-tool="viewer">
View in 3D
</button>

Example 2: Product Configuration

<div class="autoviz my-custom-class"
data-tool="viewer"
data-group="series-z"
data-select-field="finish_name"
data-select-current="chrome"
data-display-mode="fullscreen"
data-fullscreen-avoid=".site-header">
<img src="wheel-thumb.jpg" alt="Configure Wheel">
<span>Customize Your Wheel</span>
</div>

Example 3: Customized UI

<button class="autoviz my-button"
data-tool="viewer"
data-group="wheels"
data-theme="dark"
data-primary-color="FF6B6B"
data-hide-nav="1"
data-config-button="1">
View in 3D
</button>

Dynamic Value Resolution

You can use dynamic values in data attributes that are resolved from the current page URL:

Query Parameter Values (?)

Use ?param_name to get values from URL query parameters:

<!-- URL: https://example.com/wheels?finish=chrome&color=red -->
<button data-select-current="?finish">View</button>
<!-- Resolves to: data-select-current="chrome" -->

<button data-theme="?theme">View</button>
<!-- If ?theme=dark in URL, resolves to: data-theme="dark" -->

Path Segment Values (/)

Use /index to get values from URL path segments (0-based index):

<!-- URL: https://example.com/wheels/series-a/finish-1 -->
<button data-group="/1">View</button>
<!-- Resolves to: data-group="series-a" -->

<button data-select-current="/2">View</button>
<!-- Resolves to: data-select-current="finish-1" -->

Supported Attributes

Dynamic values work with these attributes:

  • data-group
  • data-part-id
  • data-variant-id
  • data-select-current
  • data-select-field
  • data-spec-* (see Part Specification)

Examples

<!-- URL: https://mystore.com/products/wheels/12345?finish=chrome&size=20 -->

<!-- Query param resolution -->
<button data-select-current="?finish">View</button>
<!-- Result: data-select-current="chrome" -->

<!-- Path segment resolution -->
<button data-group="/1">View</button>
<!-- Result: data-group="wheels" -->

<button data-part-id="/2">View</button>
<!-- Result: data-part-id="12345" -->