Skip to content
🗃 Embeddable widgets for your website
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
.editorconfig
.gitignore
.travis.yml
LICENSE
README.md
package.json
tsconfig.json
webpack.config.ts
yarn.lock

README.md

🗃 Embed widget

Add widgets to your website, powered by embedded frames.

⭐ Usage

Install the library as a dependency:

npm install embed-widget

Or, if you're using Yarn:

yarn add embed-widget

Then import the library:

import widget from "embed-widget";

And initialize it with an optional selector:

const embed = new widget("https://example.com", "Button text!");
<script src="https://unpkg.com/embed-widget"></script>

💻 API

You can use the following methods with a widget:

Open/close/togggle

embed.open(); // Open the widget
embed.close(); // Close the widget
embed.toggle(); // Open if closed, close if opened

Remove

embed.destroy(); // Remove button and frame from DOM

🛠️ Development

Install dependencies:

yarn

Start local development server and Prettier watcher:

yarn start

Compile Typescript to ES6 before publishing to NPM:

yarn build
You can’t perform that action at this time.