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

@klyro/widget

v2.3.5

Published

Klyro Chat Widget - An AI-powered chat widget for your website.

Readme

@klyro/widget

The Klyro widget allows you to easily embed an AI-powered chat interface into any website. It works as a simple script tag for static sites or as a React-compatible module for modern applications.

Installation

npm install @klyro/widget

Obtaining Your Widget Key

To use the widget, follow these steps in your Klyro dashboard:

  1. Add Knowledge:
    • Log in to your dashboard at https://klyro-pro.vercel.app/.
    • Navigate to the Knowledge Base tab.
    • Upload documents (PDFs, TXT) or add text. This is the data your AI will use to answer visitor questions.
  2. Define AI Persona:
    • Go to the AI Persona tab.
    • Customize your bot's identity, communication style (e.g., professional, casual), and specific traits. This defines how your bot speaks.
  3. Customize UI & Retrieve Key:
    • Navigate to the Integrations tab.
    • Click the Settings icon (⚙️) on your widget card to customize the Primary Color, Greeting Message, Theme, and Position.
    • Once saved, your unique Widget Key will be visible in the "Installation Code" section of this tab.

Usage

1. React / Next.js (Recommended)

For modern frameworks, use the programmatic initKlyro function.

"use client";
import { useEffect } from "react";
import { initKlyro } from "@klyro/widget";

export default function ChatWidget() {
  useEffect(() => {
    initKlyro({
      key: "YOUR_WIDGET_KEY",
    });
  }, []);

  return null;
}

2. Static HTML (Script Tag)

Add the following script tag to your HTML <head> or before the closing </body> tag.

<script
  src="https://unpkg.com/@klyro/widget/dist/widget.js"
  data-widget-key="YOUR_WIDGET_KEY"
  async
></script>

Configuration Options

When using initKlyro(options), you can pass the following properties:

| Property | Type | Description | Required | | -------- | -------- | ----------------------------- | -------- | | key | string | Your unique Klyro widget key. | Yes |


Troubleshooting & Common Issues

1. "Cannot find module '@klyro/widget'"

If you're using TypeScript and see this error after installing:

  • Ensure you are on version 1.1.1 or higher (which includes types).
  • Restart your TypeScript server (VS Code: Cmd+Shift+P -> TypeScript: Restart TS Server).

2. "document is not defined" (SSR Error)

The widget interacts with the DOM and cannot run on the server.

  • Next.js: Ensure the component calling initKlyro is marked with "use client"; and the call is inside a useEffect hook.
  • Other Frameworks: Ensure initialization only happens after the window/document is available.

3. CORS Policy Blocked

If the widget fails to fetch its configuration:

  • Ensure your backend allows requests from the domain where the widget is hosted.

4. Widget Not Appearing

  • Verify your data-widget-key is correct.
  • Check the browser console for any "404 Not Found" errors related to the widget configuration fetch.
  • Ensure the allowed routes in your Klyro dashboard match the current URL.

License

MIT © Klyro