npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@disruptica/ladybug-widget

v0.6.6

Published

Embeddable chat widget for Ladybug

Downloads

3,071

Readme

@disruptica/ladybug-widget

Embeddable chat widget for Ladybug. Drop it into any website via a script tag, ES module import, or Web Components.

Installation

npm install @disruptica/ladybug-widget

Or load directly from a CDN (no install needed):

<!-- IIFE — classic script tag -->
<script src="https://cdn.jsdelivr.net/npm/@disruptica/ladybug-widget@latest/dist/widget.js"></script>

<!-- ESM — modern browsers -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@disruptica/ladybug-widget@latest/dist/widget.esm.js"></script>

<!-- Web Components -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@disruptica/ladybug-widget@latest/dist/widget.elements.js"></script>

Usage

Script tag (zero config)

Add data-embed-key to the script tag and the widget auto-initializes with a floating launcher button.

<script
  src="https://cdn.jsdelivr.net/npm/@disruptica/ladybug-widget@latest/dist/widget.js"
  data-embed-key="emb_xxx"
  data-position="bottom-right"
  data-primary-color="#4f46e5"
  data-mode="system"
></script>

Programmatic API (ESM)

import { LadybugWidget } from '@disruptica/ladybug-widget';

const widget = new LadybugWidget({
  embedKey: 'emb_xxx',
  position: 'bottom-right',   // or 'bottom-left'
  primaryColor: '#4f46e5',
  mode: 'system',             // 'light' | 'dark' | 'system'
  launcherLabel: 'Get help',
  showLauncher: true,
});

widget.open();
widget.close();
widget.toggle();
widget.destroy();

The widget automatically detects the origin from the script tag or current page URL.

Hide the launcher, trigger manually

const widget = new LadybugWidget({
  embedKey: 'emb_xxx',
  showLauncher: false,
});

document.getElementById('my-button').addEventListener('click', () => {
  widget.toggle();
});

data-* click delegation

No JS needed — use data-ladybug-toggle, data-ladybug-open, or data-ladybug-close on any element:

<button data-ladybug-toggle="emb_xxx">Open chat</button>
<button data-ladybug-close="emb_xxx">Close chat</button>

Web Components

<script type="module" src="https://cdn.jsdelivr.net/npm/@disruptica/ladybug-widget@latest/dist/widget.elements.js"></script>

<!-- Animated launcher button -->
<ladybug-button embed-key="emb_xxx" color="#4f46e5" mode="system"></ladybug-button>

<!-- Headless widget (controlled via attribute) -->
<ladybug-chat embed-key="emb_xxx" color="#4f46e5"></ladybug-chat>
<button onclick="document.querySelector('ladybug-chat').open()">Open</button>

Identify logged-in users

Pass a short-lived signed token from your backend so Ladybug can associate widget sessions with real users. Generate the token using @disruptica/ladybug-identity.

// Static token
new LadybugWidget({
  embedKey: 'emb_xxx',
  userToken: await fetchTokenFromYourBackend(),
});

// Dynamic provider (refreshed automatically)
new LadybugWidget({
  embedKey: 'emb_xxx',
  getUserToken: async () => {
    const res = await fetch('/api/ladybug-token');
    const { token } = await res.json();
    return token;
  },
});

Listen to state changes

document.addEventListener('ladybug:change', (e) => {
  const { open, embedKey } = e.detail;
  console.log(`Widget ${embedKey} is now ${open ? 'open' : 'closed'}`);
});

Utility helpers

import { getWidget, getOrCreateWidget, closeAll } from '@disruptica/ladybug-widget';

const widget = getWidget('emb_xxx');   // undefined if not created yet
const widget2 = getOrCreateWidget({ embedKey: 'emb_xxx' });
closeAll();

Configuration

| Option | Type | Default | Description | |---|---|---|---| | embedKey | string | required | Your embed key (emb_xxx) | | position | "bottom-right" \| "bottom-left" | "bottom-right" | Launcher position | | launcherLabel | string | "Request a change" | Button label | | primaryColor | string | "#4f46e5" | Hex accent color | | mode | "light" \| "dark" \| "system" | "system" | Color mode | | showLauncher | boolean | true | Show the floating launcher button | | userToken | string | — | Signed identity token | | getUserToken | () => Promise<string \| null> | — | Async token provider |


License

MIT