Add Gurubase AI assistant to your website
https://www.example.com
will only work on that exact domain.
https://docs.example.com
https://example.org
http://localhost:3000
)*
) expression:
*.example.com
will match any subdomain of example.com
http://localhost:*
will match any port of localhost
*
will match any domain, so be careful with this option! Anyone who knows your Widget ID can send requests to your Guru.Option | Description | Default |
---|---|---|
data-widget-id | Your widget ID (required) | - |
data-text | Button text | ”Ask AI” |
data-margins | Button positioning | {"bottom": "1rem", "right": "1rem"} |
data-light-mode | Light mode toggle. Possible values are "light" , "dark" , "auto" . Auto mode syncs the widget theme with the website’s theme | "dark" |
data-bg-color | Primary color | Fetched from Gurubase |
data-icon-url | Custom logo URL | Fetched from Gurubase |
data-name | Custom name | Fetched from Gurubase |
data-baseUrl | URL to your Gurubase backend. Only for self-hosted Gurubase (Enterprise plan). | Gurubase Cloud |
data-tooltip | Tooltip text | null |
data-tooltip-side | "top" , "bottom" , "left" , "right" , "top left" , "top right" , "bottom left" , "bottom right" | "left" |
data-overlap-content | Whether to overlap the main content or shrink its width with the sidebar | "false" |
data-baseUrl
attribute. The default URL of Self-hosted Gurubase instance is http://localhost:8029/api/
.switchTheme(lightMode = null)
You can use this function to sync the theme of the widget with the theme of your website. It accepts an optional lightMode
boolean parameter to force the widget to be in light/dark mode. 3 possible usages of this function:
switchTheme()
: Toggle the themeswitchTheme(true)
: Force light modeswitchTheme(false)
: Force dark modewindow.chatWidget.switchTheme();
An example usage is shown in the MKDocs example in the theme-switch.js
script. It toggles the theme of the widget based on the MkDocs website by listening for changes in the theme and using this function with each change.