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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@archbee/app-widget

v1.1.33

Published

## Table of Contents

Downloads

1,018

Readme

Archbee React Component Widget

Table of Contents

Installation

To install, you can use npm or yarn:

$ npm install --save @archbee/app-widget
$ yarn add @archbee/app-widget

If you need to install Archbee Contextual Widget SDK, you can find more details here.

API documentation

The primary documentation for Archbee React component Widget can be found in docs, which describes the API and gives examples of its usage.

Examples

Here is a simple example of Archbee React widget being used in an app with some action variations:

import React from 'react'
import { ArchbeeAppWidget } from '@archbee/app-widget'

function App() {
  return (
    <div>
      <ArchbeeAppWidget
        spaceId={/** published space id **/}
        onWidgetOpen={() => {
          /** ... **/
        }} // callback function called after widget has open
        // onWidgetClose={() => { /** ... **/ }} // callback function called after widget has open
      >
        <button type="button">Open</button>
      </ArchbeeAppWidget>
    </div>
  )
}

ReactDOM.render(<App />, appElement)

Can also be used with ref for a more programmatic approach:

import React from 'react';
import { ArchbeeAppWidget, AbWidgetRef } from '@archbee/app-widget'

function App() {
const widgetRef = useRef<AbWidgetRef>(null);

  return (
    <div>
        <ArchbeeAppWidget
            ref={widgetRef}
            spaceId={ /** published space id **/ }
            onWidgetOpen={() => { /** ... **/ }} // callback function called after widget has open
            onWidgetClose={() => { /** ... **/ }} // callback function called after widget has open
      >
        <button type='button' onClick={() => {
        <!-- Opens widget -->
            widgetRef.current?.open();
        }}>
          Open
        </button>

        <button type='button' onClick={() => {
        <!-- Closes widget -->
            widgetRef.current?.close();
        }}>
          Close
        </button>

        <button type='button' onClick={() => {
        <!-- Gets the instance of the widget if needed for various event manipulations. -->
            widgetRef.current?.instance();
        }}>
          Get widget instance
        </button>
      </ArchbeeAppWidget>
    </div>
  );
}

ReactDOM.render(<App />, appElement);

Component Props

| Property | Type | Required | Description | | ----------------- | ------------------ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | spaceId | string | required | Pass the desired id to load your docs. | | docId | string | optional | The doc where you want to open the widget docs. If docId is passed, widgetType is ignored, it will open in docs mode regardless of prop passed. | | blockId | string | optional | The block where you want to scroll, after a certain document was open. | | jwt | string | optional | Pass the jwt token in order to see jwt protected docs. | | shareableToken | string | optional | Pass the shareableToken from your private links to protect your docs. | | className | string | optional | Pass CSS classes to the div wrapper | | widgetType | docs \| search | optional | Default value is docs. This opens the widget with the desired behaviour. docs`` type will open the widget with the default behaviour, searchwill open a search widget bar that shows a search bar with AI support (if included in your subscription) | |bubble |ask | invisible|optional| Default value isinvisible. This prop will display an ask bubble in the bottom-right of your screen. Whenever someone clicks on it, the search widget will open. | | loadingStrategy|eager | lazy |optional| Default value islazy. While lazyloading delays the initialization of a resource,eagerloading initializes or loads the widget as soon as the code is executed. | |anchor |string |optional| You can provide yourclass, idorpathto a DOM element where you would like the widget to anchor and instantiate. The container provided should haveposition: relativeas the widget will be displayed based on the first relative parent found. | |onWidgetOpen |void |optional| Callback that is called after widget opens. | |onWidgetClose |void |optional| Callback that is called after widget closes. | |hideNavbar |boolean |optional| Default value isfalse`. It hides the header navbar from the modal. |

Bubble

Use bubble prop whenever you want an easy search button to browse your entire documentation.

Ask search bubble

Ref Methods

If ref is not passed to ArchbeeAppWidget, the children will automatically open the modal popup upon click.

| Property | Type | Description | | ---------- | -------- | ----------------------------------- | | open | method | Opens widget programatically. | | close | method | Closes widget programatically. | | instance | method | Returns the instance of the widget. |

Demos

Down below is a demo setup in CodeSandbox, which demonstrate various features of archbee-app: