Vanilla JavaScript

Use DotPassport widgets with plain JavaScript - no framework required.

Installation

NPM

npm install @dotpassport/sdk

CDN

<script type="module">
  import { createWidget, DotPassportClient } from 'https://unpkg.com/@dotpassport/sdk/dist/index.js';
</script>

Basic Usage

<!DOCTYPE html>
<html>
<head>
  <title>DotPassport Widget Demo</title>
</head>
<body>
  <div id="reputation-widget"></div>

  <script type="module">
    import { createWidget } from '@dotpassport/sdk';

    const widget = createWidget({
      apiKey: 'your_api_key',
      address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
      type: 'reputation',
      theme: 'light'
    });

    widget.mount('#reputation-widget');
  </script>
</body>
</html>

Complete HTML Example


API Client Usage


Multiple Widgets


Dynamic Widget Creation


Event-Driven Architecture


Last updated