App Widget - React
Some of the benefits on Contextual documentation are explained here. This is an alternative for React and NextJS apps to integrate the Archbee App widget in a more elegant way.
First, you need to install our npm package:
Once the package is installed, go to your jsx/tsx file and instantiate the component:
You can reference the info also from Space Settings:
- First you have to select a Space
- Click on the gear icon ⚙️ for Settings
- Go to Widget Integration
- Select React Tab and click on the copy button and paste the code into your .tsx/.jsx file
Now our react component will handle everything. Don't worry, everything is bundled and minified. The package has only 26.2Kb download and it loads asynchronously, so your users won't feel a difference.
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. |
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, search will open a search widget bar that shows a search bar with AI support (if included in your subscription) |
loadingStrategy | 'eager' | 'lazy' | optional | Default value is lazy. Loading strategy method for widget loading. |
bubble | invisible | ask | optional | The default value is invisible. If set to ask it will display a bubble in the bottom-right of your screen. Whenever someone clicks on it, the search widget will open. |
anchor | string | optional | You can provide your class, id or path to a DOM element where you would like the widget to anchor and instantiate. It will anchor to the first element found in the DOM, if multiple elements with the same path are present. The container provided should have position: relative as the widget will be displayed based on the first relative parent found. e.g.: anchor: "#my-container" / anchor: ".container-class" |
onWidgetOpen | void | optional | Callback that is called after widget opens. |
onWidgetClose | void | optional | Callback that is called after widget closes. |
The JWT and Shareable tokens are available in the Scaling plan. Read more about Public Access Controls .
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. |