integrate with web component
Render the Widget with a built-in skeleton loader and efficiently use the Widget fullscreen without writing a line of javascript code.
Web components are framework agnostic and can be used with modern frameworks and even simple HTML websites on any project. Furthermore, you can install our web components using CDN or npm.
Installation
using npm :
using CDN
Usage
We provide a set of parameters that allows you to preconfigure our widget. In addition, you can use our Ondefy Widget configurator to simplify the generation of this code.
frame-border-radius
set the border radius of the Widget
frame-height
set the height of the Widget
network-id
preselected network
token-id
preselected token
color-primary
the primary color of the widget
theme
dark | light
Launch in fullscreen
Widget can be open on site in fullscreen mode.
Method 1: Ondefy widget button
Use your component or any HTML tag inside our custom element.
Just write any HTML tag inside.
<ondefy-widget-button>
- makes everything you put inside clickable. And this element will launch our Widget in fullscreen.
You can put into this web component any HTML tag or any component from any framework: react.js, angular.js, vue.js, etc.
You can also preconfigure our Widget with optional parameters.
Method 2: Programmatically launch the Widget fullscreen using Ondefy global service
If you don't want to use our web component, you can use the method from our Ondefy global service method to launch the Widget fullscreen programmatically.
You don't need to import Ondefy
anywhere as this variable is global and belongs to window
. all the time anywhere in your code if you installed Ondefy Web components properly
or with optional params
Method 3: Programmatically launch the Widget using the Custom Event
If you feel like using Ondefy
global service doesn't fit the architecture of your app but still needs a way to launch the Widget programmatically. You can trigger our custom event launch-widget-fullscreen
on document.body
like this
or with optional parameters
Typescript notes
If your compiler complains, try creating react-app-env.d.ts
in the root of your project for react.js projects:
Last updated