Customization
Change the button's label, give it your own classes, or restyle it with CSS variables.
<vizbl-core> draws one button inside itself: a link in ar-one-click mode and a <button> in the others. You can change its label and its look in three ways, from lightest to fullest.
Label
Without content the button shows its mode's label: View in 3D & AR, View in AR or View in advanced AR. Text or elements inside <vizbl-core> replace it:
<vizbl-core api-key="pk_live_YOUR_PUBLISHABLE_KEY" type="ar-viewer" object-id="YOUR_OBJECT_ID">
See it in your room
</vizbl-core>The element moves its content into the button when it starts. In React, keep the label fixed; to change it, render a new element, for example with a new key.
CSS variables
The default button reads these variables. Set them on vizbl-core itself to restyle the button without replacing it; the element sets its own defaults, so a value on a parent does not reach it:
| Variable | Default |
|---|---|
--core-ar-widget-background | #3556f0 |
--core-ar-widget-background-hover | #2743cc |
--core-ar-widget-background-active | #2239ad |
--core-ar-widget-border-color | #3556f0 |
--core-ar-widget-border-radius | 0.5rem |
--core-ar-widget-color | #ffffff |
--core-ar-widget-focus-ring | #3556f0 |
--core-ar-widget-font-family | system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif |
--core-ar-widget-font-size | 0.875rem |
--core-ar-widget-font-weight | 500 |
--core-ar-widget-padding | 0.375rem 0.75rem |
vizbl-core {
--core-ar-widget-background: #111827;
--core-ar-widget-background-hover: #1f2937;
--core-ar-widget-background-active: #374151;
--core-ar-widget-border-color: #111827;
--core-ar-widget-border-radius: 999px;
--core-ar-widget-font-family: inherit;
--core-ar-widget-padding: 0.75rem 1.5rem;
}The defaults sit in a :where() selector, which has no weight, so variables you set on vizbl-core always win.
Your own classes
trigger-class puts classes on the button itself, so the button can look like the rest of your store's buttons. Add unstyled to drop the default look, and only your classes style it:
<vizbl-core
api-key="pk_live_YOUR_PUBLISHABLE_KEY"
type="ar-viewer"
object-id="YOUR_OBJECT_ID"
trigger-class="btn btn-secondary"
unstyled
></vizbl-core>Without unstyled, your classes add to the default look, and the default wins where both set the same property, such as the background. Use the CSS variables for those, or add unstyled.
With Tailwind CSS, write the classes in full in your source, as above. Tailwind generates only the classes it finds in your files, so a class built from parts at runtime, or kept only in a CMS, needs a place in your safelist.
In React, pass unstyled as a boolean:
<vizbl-core
api-key="pk_live_YOUR_PUBLISHABLE_KEY"
type="ar-viewer"
object-id={objectId}
trigger-class="rounded-full bg-black px-6 py-3 text-white"
unstyled
/>States
The element sets data-state on itself: loading while it reads the model, and again while a tap loads the viewer; ready when the button works; opening while a tap opens the viewer or AR; and error when it could not start or a tap failed. The button cannot be pressed in any state but ready. Style the states from your own CSS:
vizbl-core[data-state='loading'] .btn {
cursor: progress;
}
vizbl-core[data-state='error'] {
display: none;
}In error, data-error-code holds the error code. Hiding the element then keeps a button that cannot work off your page.