Functions
The website widget exposes a set of functions on the global window.Kapa
object, allowing you to manipulate it programmatically. The following functions are available:
open
Open the website widget.
Optional parameters:
Parameter | Type | Default | Description |
---|---|---|---|
mode | 'search' | 'ai' | 'ai' | The mode the widget is set to when the modal is opened. |
query | string | '' | Opens the widget with this query prefilled. |
submit | boolean | false | Automatically submit the query when the model is opened. |
Example usage:
window.Kapa.open({
mode: "ai",
query: "How to get started?",
submit: true,
});
close
Close the website widget.
Example usage:
window.Kapa.close();