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.
window.relevance.show()
window.relevance.show()
Shows the Ask Relevance widget.
// Example 1: Invoking the widget programatically
window.relevance.show()
// Example 2: Custom button
<button onclick="window.relevance.show()">Search docs</button>
window.relevance.hide()
window.relevance.hide()
Hides the Ask Relevance widget.
// Example 1: Hiding the widget
window.relevance.hide()
// Example 2: Custom button
<button onclick="window.relevance.hide()">Search docs</button>
Updated 5 months ago