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

react-copilot-embed-sandbox

v0.2.1

Published

This guide provides instructions on how to integrate the `react-copilot-embed-sandbox` component into various frameworks and vanilla JavaScript projects. The styles applied in the example are excluded to focus on the core integration steps.

Readme

React Copilot Embed Sandbox Integration Guide

This guide provides instructions on how to integrate the react-copilot-embed-sandbox component into various frameworks and vanilla JavaScript projects. The styles applied in the example are excluded to focus on the core integration steps.


Table of Contents

  1. Vanilla JavaScript
  2. React
  3. Vue
  4. Angular
  5. Svelte

Vanilla JavaScript

Steps:

  1. Include the required scripts for React and ReactDOM.
  2. Include the UMD build of react-copilot-embed-sandbox.
  3. Create a container element for the Copilot component.
  4. Render the Copilot component using React.createElement.

Example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Copilot Example</title>
  </head>
  <body>
    <div id="root"></div>

    <!-- Include React and ReactDOM -->
    <script src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>

    <!-- Include your UMD build -->
    <script src="https://cdn.jsdelivr.net/npm/react-copilot-embed-sandbox@latest/dist/index.umd.js"></script>

    <!-- Your App Script -->
    <script>
      // Access global variables
      const { Copilot } = window["react-copilot-embed-sandbox"];

      // Define your App component
      function App() {
        return React.createElement(
          "div",
          null,
          React.createElement(Copilot, {
            apiKey: "YOUR_API_KEY", // Replace with your API key
            copilot: "apex",
          })
        );
      }

      // Render the App component
      ReactDOM.render(
        React.createElement(App),
        document.getElementById("root")
      );
    </script>
  </body>
</html>

React

Steps:

  1. Install the react-copilot-embed-sandbox package.
  2. Import and use the Copilot component in your React application.

Example:

npm install react-copilot-embed-sandbox
import React from "react";
import ReactDOM from "react-dom";
import { Copilot } from "react-copilot-embed-sandbox";

function App() {
  return (
    <div>
      <Copilot
        apiKey="YOUR_API_KEY" // Replace with your API key
        copilot="apex"
      />
    </div>
  );
}

ReactDOM.render(<App />, document.getElementById("root"));

Vue

Steps:

  1. Install the react-copilot-embed-sandbox package.
  2. Use a wrapper component to integrate the React component into Vue.

Example:

npm install react-copilot-embed-sandbox
<template>
  <div id="app">
    <div ref="copilotContainer"></div>
  </div>
</template>

<script>
import { Copilot } from "react-copilot-embed-sandbox";
import React from "react";
import ReactDOM from "react-dom";

export default {
  mounted() {
    ReactDOM.render(
      React.createElement(Copilot, {
        apiKey: "YOUR_API_KEY", // Replace with your API key
        copilot: "apex",
      }),
      this.$refs.copilotContainer
    );
  },
  beforeDestroy() {
    ReactDOM.unmountComponentAtNode(this.$refs.copilotContainer);
  },
};
</script>

Angular

Steps:

  1. Install the react-copilot-embed-sandbox package.
  2. Use Angular's ngAfterViewInit lifecycle hook to render the React component.

Example:

npm install react-copilot-embed-sandbox
import { Component, AfterViewInit, ViewChild, ElementRef } from "@angular/core";
import { Copilot } from "react-copilot-embed-sandbox";
import * as React from "react";
import * as ReactDOM from "react-dom";

@Component({
  selector: "app-root",
  template: `<div #copilotContainer></div>`,
})
export class AppComponent implements AfterViewInit {
  @ViewChild("copilotContainer", { static: false })
  copilotContainer!: ElementRef;

  ngAfterViewInit() {
    ReactDOM.render(
      React.createElement(Copilot, {
        apiKey: "YOUR_API_KEY", // Replace with your API key
        copilot: "apex",
      }),
      this.copilotContainer.nativeElement
    );
  }

  ngOnDestroy() {
    ReactDOM.unmountComponentAtNode(this.copilotContainer.nativeElement);
  }
}

Svelte

Steps:

  1. Install the react-copilot-embed-sandbox package.
  2. Use Svelte's onMount lifecycle function to render the React component.

Example:

npm install react-copilot-embed-sandbox
<script>
  import { onMount } from "svelte";
  import { Copilot } from "react-copilot-embed-sandbox";
  import * as React from "react";
  import * as ReactDOM from "react-dom";

  let copilotContainer;

  onMount(() => {
    ReactDOM.render(
      React.createElement(Copilot, {
        apiKey: "YOUR_API_KEY", // Replace with your API key
        copilot: "apex",
      }),
      copilotContainer
    );

    return () => {
      ReactDOM.unmountComponentAtNode(copilotContainer);
    };
  });
</script>

<div bind:this={copilotContainer}></div>

This documentation provides a clear and concise way to integrate the react-copilot-embed-sandbox component into your project, regardless of the framework you're using.