SDK: Methods

Loading the Ask Relevance widget exposes methods on the Window object which allow you to control it programatically.


Trying to implement a custom trigger?

Headless mode hides the default trigger. This lets you control widget visibility programatically using a custom button or keyboard shortcut. Headless mode can be enabled when you configure the Ask Relevance widget.

Shows the Ask Relevance widget.

// Example 1: Invoking the widget programatically 

// Example 2: Custom button
<button onclick="">Search docs</button>


Hides the Ask Relevance widget.

// Example 1: Hiding the widget

// Example 2: Custom button 
<button onclick="window.relevance.hide()">Search docs</button>