1.1.26 • Published 1 month ago

@archbee/app-widget v1.1.26

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 month ago

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

PropertyTypeRequiredDescription
spaceIdstringrequiredPass the desired id to load your docs.
docIdstringoptionalThe 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.
blockIdstringoptionalThe block where you want to scroll, after a certain document was open.
jwtstringoptionalPass the jwt token in order to see jwt protected docs.
shareableTokenstringoptionalPass the shareableToken from your private links to protect your docs.
classNamestringoptionalPass CSS classes to the div wrapper
widgetTypedocs \| searchoptionalDefault value is docs. This opens the widget with the desired behaviour. docs`` type will open the widget with the default behaviour,search` will open a search widget bar that shows a search bar with AI support (if included in your subscription)
bubbleask \| invisibleoptionalDefault value is invisible. This prop will display an ask bubble in the bottom-right of your screen. Whenever someone clicks on it, the search widget will open.
loadingStrategyeager \| lazyoptionalDefault value is lazy. While lazy loading delays the initialization of a resource, eager loading initializes or loads the widget as soon as the code is executed.
anchorstringoptionalYou can provide your class, id or path to a DOM element where you would like the widget to anchor and instantiate. The container provided should have position: relative as the widget will be displayed based on the first relative parent found.
onWidgetOpenvoidoptionalCallback that is called after widget opens.
onWidgetClosevoidoptionalCallback that is called after widget closes.

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.

PropertyTypeDescription
openmethodOpens widget programatically.
closemethodCloses widget programatically.
instancemethodReturns the instance of the widget.

Demos

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

1.1.26

1 month ago

1.1.25

1 month ago

1.1.24

2 months ago

1.1.23

3 months ago

1.1.22

3 months ago

1.1.21

3 months ago

1.1.20

4 months ago

1.1.19

4 months ago

1.1.18

4 months ago

1.1.17

4 months ago

1.1.16

4 months ago

1.1.15

4 months ago

1.1.14

4 months ago

1.1.13

4 months ago

1.1.12

4 months ago

1.1.11

4 months ago

1.1.10

4 months ago

1.1.9

4 months ago

1.1.8

4 months ago

1.1.7

4 months ago

1.1.6

4 months ago

1.1.5

5 months ago

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.64

6 months ago

1.0.63

6 months ago

1.0.62

6 months ago

1.0.61

6 months ago

1.0.60

6 months ago

1.0.59

6 months ago

1.0.58

6 months ago

1.0.57

6 months ago

1.0.56

6 months ago

1.0.55

6 months ago

1.0.54

6 months ago

1.0.53

6 months ago

1.0.52

6 months ago

1.0.51

6 months ago

1.0.50

6 months ago

1.0.49

6 months ago

1.0.48

6 months ago

1.0.46

6 months ago

1.0.45

6 months ago

1.0.44

6 months ago

1.0.43

6 months ago

1.0.42

6 months ago

1.0.41

6 months ago

1.0.40

6 months ago

1.0.39

6 months ago

1.0.38

6 months ago

1.0.37

6 months ago

1.0.36

6 months ago

1.0.35

6 months ago

1.0.34

6 months ago

1.0.33

6 months ago

1.0.30

6 months ago

1.0.29

6 months ago

1.0.27

6 months ago

1.0.26

6 months ago

1.0.25

6 months ago

1.0.24

6 months ago

1.0.23

6 months ago

1.0.22

6 months ago

1.0.21

6 months ago

1.0.20

6 months ago

1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago