Skip to content

JavaScript API

Open widget

Use Ybug.open() to open the Feedback Widget.

javascript
// Open the default widget screen
Ybug.open();

// Open the feedback form (skipping the welcome screen)
Ybug.open('feedback');

// Open the annotation page
Ybug.open('annotate');

Close widget

To close the widget if it's open, use Ybug.close():

javascript
// Close opened widget
Ybug.close();

Hide widget

To hide the widget on certain pages, use Ybug.hide(). Pass 'launcher' as the first argument to hide only the launcher button.

javascript
// Hide the widget or launcher
Ybug.hide();

// Hide launcher (if visible)
Ybug.hide('launcher');

Show widget

To show the widget if you previously hid it, use Ybug.show(). Pass 'launcher' as the first argument to show only the launcher button.

javascript
// Show the widget or launcher
Ybug.show();

// Show launcher (if hidden previously)
Ybug.show('launcher');

Destroy widget

To entirely unmount the widget on certain pages, call Ybug.destroy(). This destroys both the widget and the launcher:

javascript
// Unmount the Feedback Widget
Ybug.destroy();

Initialize widget

To initialize the Feedback Widget after you've previously unmounted it, call Ybug.boot(). There's no need to call this on a usual page load — only after Ybug.destroy().

javascript
// Initialize the widget again
Ybug.boot();