| You add markup | Use it when | |
|---|---|---|
| The widget places the button | No | You cannot edit your docs theme: Mintlify, GitBook, ReadMe, a hosted help center |
| Your own button | Yes | You control the page |
The widget places the button
Name an element already in your header, usually the search box. The widget puts a labelled Ask AI button next to it:- Every match gets a button. Themes often have separate desktop and mobile headers; list both, as above.
- It keeps watching. If your header is drawn late or redrawn on navigation, the button comes back.
- It falls back to the corner. If nothing matches within 10 seconds, the corner button appears instead and the console says why. An invalid selector falls back at once.
- It replaces the corner button. Add
data-launcher-button-floating="true"to keep both. Useful when your theme hides its header controls on phones. - Your header’s CSS cannot reach it, so it keeps its own look.
- It does not shift your header. In a header that centres or spreads its items, the button is laid over the page next to the element instead of being added to the row. To do this it sets
position: relativeon the element if it had no position.
id or a class.
Settings
| Attribute | Default | What it does |
|---|---|---|
data-launcher-button-anchor-selector | none | The element the button goes next to. Every match gets one |
data-launcher-button-anchor-position | afterend | beforebegin, afterbegin, beforeend or afterend |
data-launcher-button-anchor-wait-ms | 10000 | How long to wait for the element before using the corner. -1 waits forever |
data-launcher-button-anchor-overlay | automatic | true always lays the button over the page, false always adds it to the row |
data-launcher-button-floating | false | Keep the corner button as well |
data-launcher-button-text | Ask AI | The label |
data-launcher-button-anchor-shape | rounded | pill, square or circle. circle shows the icon only |
data-launcher-button-anchor-size | 36px | The button’s height |
data-launcher-button-anchor-text-size | 13px | The label’s size |
data-brand-color. If you set data-product-logo, the logo replaces the sparkle icon; add data-launcher-button-image-hidden="true" to keep the sparkle. Component styles such as data-launcher-button-background-color apply to the header and corner buttons alike. data-launcher-button-hidden="true" removes both.
The
search view mode has no launcher at all. Open it from your own search box with data-search-input. See Search mode.Your own button
Draw the button yourself and tell the widget which element it is:#docs-search. data-launcher-button-hidden="true" removes the corner button; leave it out to keep both.
Open triggers
Each trigger takes a CSS selector. Use.name for a class and #name for an element id, and separate several with commas.
| Opens | Attribute |
|---|---|
| The tab last used | data-modal-override-open-selector |
| The chat | data-modal-override-open-selector-ask-ai |
| The Search tab | data-modal-override-open-selector-search |
- Buttons your site draws later, or redraws on navigation, still work.
- A trigger that is a link opens the widget instead of navigating.
Carrying the query
| Attribute | Default | What it does |
|---|---|---|
data-open-query-from | the data-search-input field | The field whose text becomes the question. Works with inputs, textareas and contenteditable boxes |
data-open-submit | true | Send it at once. false puts it in the question box for the reader to send. An empty field sends nothing |
From JavaScript
Callwindow.KeluWidget.open({ mode: "ai", query, submit: true }) from your own click handler. See Functions.