Skip to main content

Configuration

The Kapa widget is integrated into webpages with JavaScript. This means that the configuration of your widget is done through setting parameters on that script. See below for the full list of all available configuration options. You can configure both the styling and functional behavior of your widget. You can refer to our best practice guide for an in depth guide, and more ways to deploy your widget.

Required parameters

The following parameters are required to configure the website widget:

ParameterDescription
data-website-idObtain this ID from the Kapa team for your website.
data-project-nameSet the name to be displayed at the top of the website widget.
data-project-colorChoose the default color for the widget (use a HEX color code).
data-project-logoProvide a link to the logo you want to use (a square format is recommended).

Here is an example for the Kapa widget we use on our website below with the required parameters and a few recommended optional parameters:

<script
async
src="https://widget.kapa.ai/kapa-widget.bundle.js"
data-website-id="XXX-XXX-XXX"
data-project-name="kapa.ai"
data-project-color="#6306B6"
data-project-logo="kapa.ai/assets/logo.png"
data-modal-disclaimer="This is a custom LLM with access to all [Kapa documentation](https://docs.kapa.ai)."
data-modal-example-questions="How do I get started?,How to add example questions?"
data-user-analytics-fingerprint-enabled="true"
></script>

Behavioral parameters (optional)

In addition to above required parameters, you can also add the following optional parameters to customize the beahvior of your website widget:

The default behavior is to open the modal on clicking the "Ask AI" button. If you want to override this behavior, you can set the following parameters:

ParameterDescription
data-button-hideSet to "true" to hide the button. Default is not set.
data-modal-override-open-classSet to a class name (e.g., "my-search-bar-class") to override the modal open behavior. Default is not set.
data-modal-override-open-idSet the ID of your HTML element (e.g., "my-search-bar-id") to override the modal open behavior. Default is not set. More efficient than data-modal-override-open-class.
data-modal-override-open-class-searchSet to a class name (e.g., "my-search-bar-class") to override the modal open behavior with search mode as the default.
data-modal-override-open-id-searchSet the ID of your HTML element (e.g., "my-search-bar-id") to override the modal open behavior with search mode as the default. More efficient than data-modal-override-open-class-search.
data-modal-override-open-class-ask-aiSet to a class name (e.g., "my-search-bar-class") to override the modal open behavior with ask-AI mode as the default.
data-modal-override-open-id-ask-aiSet the ID of your HTML element (e.g., "my-search-bar-id") to override the modal open behavior with ask-AI mode as the default. More efficient than data-modal-override-open-class-ask-ai.
data-modal-open-by-defaultSet to "true" to open the modal by default when loading it on a page. Default is not set.
data-modal-open-on-command-kSet to "true" to enable opening the modal with Cmd+K. Default is "false".
data-render-on-loadDetermines whether the widget is rendered immediately when the script loads. This is useful if you want to manually control when to render the widget, such as after a user action. In such cases, you can defer the widget's rendering by setting this option to "false" and trigger it later using the window.Kapa.render() function.

Text and image customization

You can customize the text that appears in the widget by setting the following parameters:

ParameterDescription
data-modal-titleSet the title for the modal. Default is "[project name] Docs AI".
data-modal-title-ask-aiWhen search mode is enabled, set the title for the modal when the ask AI mode is active. Default is the value of data-modal-title.
data-modal-title-searchWhen search mode is enabled, set the title for the modal when the search mode is active. Default is the value of data-modal-title.
data-modal-disclaimerSet a disclaimer to appear at the top of the modal (e.g., results are AI-generated). Supports Markdown. Default is not set.
data-modal-example-questionsComma-separated list of example questions to show in the modal (e.g., "How do I get started?,What Python version do I need?"). Default is not set.
data-modal-example-questions-titleTitle above the example questions. Default is "EXAMPLE QUESTIONS".
data-modal-ask-ai-input-placeholderSet the placeholder text for the Ask AI input field. Default is "Ask me a question about [project name]...".
data-answer-feedback-info-textInfo text below the feedback buttons. Default is "All feedback is reviewed by the team.".
data-uncertain-answer-calloutAn additional message, formatted as Markdown, that is directly appended to the answer when uncertainty is detected (e.g., "Hmm, I don't know enough to give you a confident answer yet."). Default is not set.
data-modal-search-input-placeholderSet the placeholder text for the Search mode search bar. Default is "Search sources...".
data-modal-imageProvide a URL for the image in the modal header. Default is [project-logo].
data-modal-image-ask-aiProvide a URL for the image in the modal header when Ask AI mode is enabled. Default is the value of data-modal-image.
data-modal-image-searchProvide a URL for the image in the modal header when Search mode is enabled. Default is the value of data-modal-image.
data-modal-image-hideSet to "true" to hide the image in the modal. Default is not set.
data-button-imageProvide a URL for the image in the button. Default is [project-logo].
data-button-textSet the text for the search button. Default is "Ask AI".

Search configuration

By default, the search mode is not enabled. You can enable it and customize its behaviour with the following parameters:

ParameterDescription
data-search-mode-enabledSet to "true" to enable the search mode. Default is "false".
data-search-mode-defaultSet to "true" to set search as the default mode when the widget is triggered. Default is "false".
data-modal-command-k-search-mode-defaultSet to "true" to set search as the default mode when the widget is triggered via Cmd + K. Default is "false".
data-search-display-num-resultsThe number of results displayed per "page" before the user needs to hit "Show more". Default is "5".
data-search-include-source-namesDefine the set of source names to be included in the search. Remaining sources will be excluded. Source names can be found in the Kapa platform. Default is not set. Example: '["Source A", "Source B"]'.
data-search-source-group-orderDefine the order in which sources should be grouped in the results list. Default is not defined.
data-search-keyboard-nav-enabledSet to "false" to disable keyboard navigation. Default is "true".
data-search-show-ask-ai-ctaSet to "false" to disable the Ask AI CTA in search results. Default is "true".

Anonymous user tracking

By default, the widget does not track or store any data besides the questions asked by users and answers provided by the AI model. However, you can enable anonymous user tracking to gain insights into user interactions without storing any personal data. Read more about anonymous user tracking.

ParameterDescription
data-user-analytics-fingerprint-enabledSet to "true" to enable anonymous user tracking. Default is "false".
data-user-satisfaction-feedback-enabledSet to "false" to prevent the survey from being shown to users.

By default, consent from users is not required in order to chat with Kapa. If you wish to enable requiring user consent, you can configure a consent screen with the following parameters:

ParameterDescription
data-consent-requiredSet to "true" to enable the consent check. Enabling this will set a kapa_consent cookie in the browser. Default is "false".
data-consent-screen-titleDefault is "Hi there, do you want to use the AI chat?".
data-consent-screen-disclaimerDefault is "By clicking the "I agree, let's chat" button, you agree to the necessary cookies. You can find more information in our privacy policy.".
data-consent-screen-accept-button-textDefault is "I agree, lets chat!".
data-consent-screen-reject-button-textDefault is "No, not interested".

Call to action button

It’s possible to add a custom call-to-action (CTA) button below the Kapa answer, which can redirect users to a configurable link. This allows you to guide users, such as encouraging them to speak with a sales expert. You can configure the CTA button with the following parameters:

ParameterDescription
data-answer-cta-button-enabledSet to "true" to enable the CTA button.
data-answer-cta-button-linkConfigure the URL to which the CTA button should link.
data-answer-cta-button-textConfigure the text of the CTA button.

Style parameters (optional)

A set of optional parameters to configure the components' styles. You can assign any valid CSS value to these properties.

Fonts

ParameterDescription
data-font-familyDefault is "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;".
data-font-size-xsAdjust the font size for text of size XS. Default is 0.75rem.
data-font-size-smAdjust the font size for text of size SM. Default is 0.875rem.
data-font-size-mdAdjust the font size for text of size MD. Default is 1rem.
data-font-size-lgAdjust the font size for text of size LG. Default is 1.125rem.
data-font-size-xlAdjust the font size for text of size XL. Default is 1.25rem.

Floating widget

ParameterDescription
data-button-position-topDefault is not set.
data-button-position-rightDefault is "20px".
data-button-position-bottomDefault is "20px".
data-button-position-leftDefault is not set.
data-button-z-indexDefault is "199".
data-button-heightDefault is "5rem".
data-button-widthDefault is "4.5rem".
data-button-paddingDefault is "0".
data-button-bg-colorDefault is not set.
data-button-border-radiusDefault is not set.
data-button-borderDefault is not set.
data-button-box-shadowDefault is "0 0 10px rgba(0, 0, 0, 0.2)".
data-button-image-heightDefault is "32".
data-button-image-widthDefault is "32".
data-button-text-font-sizeDefault is not set.
data-button-text-font-weightDefault is not set.
data-button-text-font-familyDefault is not set.
data-button-text-colorDefault is not set.
data-button-text-shadowDefault is "1px 1px 2px rgba(0, 0, 0, 0.2)".
data-button-animation-enabledDefault is "true".
data-button-hover-animation-enabledDefault is "true".
ParameterDescription
data-modal-close-button-hideDefault is "false".
data-modal-z-indexDefault is "200".
data-modal-sizeDefault is "640px".
data-modal-full-screenDefault is "false".
data-modal-full-screen-on-mobileDefault is "true".
data-modal-lock-scrollDefault is "true".
data-modal-x-offsetDefault is not set.
data-modal-y-offsetDefault is "10vh".
data-modal-border-radiusDefault is "0.5rem".
data-modal-disclaimer-bg-colorDefault is "#F8F9FA".
data-modal-disclaimer-text-colorDefault is "gray".
data-modal-disclaimer-font-sizeDefault is "0.75rem".
data-modal-header-logo-hide-on-mobileDefault is "false".
data-modal-header-min-heightDefault is "48px".
data-modal-header-paddingDefault is "20px".
data-modal-header-bg-colorDefault is "#F1F3F5".
data-modal-header-border-bottomDefault is "1px solid #CED4DA".
data-modal-body-bg-colorDefault is not set.
data-modal-body-padding-topDefault is "8px".
data-modal-body-padding-rightDefault is "20px".
data-modal-body-padding-bottomDefault is "20px".
data-modal-body-padding-leftDefault is "20px".
data-modal-title-font-familyDefault is not set.
data-modal-title-font-sizeDefault is not set.
data-modal-title-font-weightDefault is not set.
data-modal-title-colorDefault is not set.
data-modal-image-heightDefault is "32".
data-modal-image-widthDefault is "32".
data-modal-with-overlayDefault is "true".
data-modal-overlay-bg-colorDefault is "rgba(0, 0, 0, 0.6)".
data-modal-overlay-opacityDefault is "1".
data-modal-example-questions-col-spanDefault is "6".
data-conversation-buttons-icons-onlyDefault is "false".

Query input field

ParameterDescription
data-query-input-font-sizeDefault is "0.75rem".
data-query-input-text-colorDefault is "#000".
data-query-input-placeholder-text-colorDefault is "#adb5bd".
data-query-input-border-colorDefault is "#ced4da".
data-query-input-focus-border-colorDefault is the project color.
data-submit-query-button-bg-colorDefault is the project color.

Answer feedback button

ParameterDescription
data-answer-feedback-button-heightDefault is not set.
data-answer-feedback-button-widthDefault is not set.
data-answer-feedback-button-padding-xDefault is not set.
data-answer-feedback-button-padding-yDefault is not set.
data-answer-feedback-button-borderDefault is not set.
data-answer-feedback-button-active-borderDefault is not set.
data-answer-feedback-button-border-radiusDefault is not set.
data-answer-feedback-button-bg-colorDefault is not set.
data-answer-feedback-button-active-bg-colorDefault is not set.
data-answer-feedback-button-active-hover-bg-colorDefault is "transparent".
data-answer-feedback-button-hover-bg-colorDefault is not set.
data-answer-feedback-button-text-colorDefault is not set.
data-answer-feedback-button-active-text-colorDefault is not set.
data-answer-feedback-button-font-sizeDefault is not set.
data-answer-feedback-button-icon-sizeDefault is not set.
data-answer-feedback-button-box-shadowDefault is not set.

Copy answer button

ParameterDescription
data-answer-copy-button-heightDefault is not set.
data-answer-copy-button-widthDefault is not set.
data-answer-copy-button-padding-xDefault is not set.
data-answer-copy-button-padding-yDefault is not set.
data-answer-copy-button-borderDefault is not set.
data-answer-copy-button-border-radiusDefault is not set.
data-answer-copy-button-bg-colorDefault is not set.
data-answer-copy-button-hover-bg-colorDefault is not set.
data-answer-copy-button-text-colorDefault is not set.
data-answer-copy-button-font-sizeDefault is not set.
data-answer-copy-button-icon-sizeDefault is not set.
data-answer-copy-button-box-shadowDefault is not set.

Clear thread button

ParameterDescription
data-thread-clear-button-heightDefault is not set.
data-thread-clear-button-widthDefault is not set.
data-thread-clear-button-padding-xDefault is not set.
data-thread-clear-button-padding-yDefault is not set.
data-thread-clear-button-borderDefault is not set.
data-thread-clear-button-border-radiusDefault is not set.
data-thread-clear-button-bg-colorDefault is not set.
data-thread-clear-button-hover-bg-colorDefault is not set.
data-thread-clear-button-text-colorDefault is not set.
data-thread-clear-button-font-sizeDefault is not set.
data-thread-clear-button-icon-sizeDefault is not set.
data-thread-clear-button-box-shadowDefault is not set.

Call to Action button styles

ParameterDescription
data-answer-cta-button-heightDefault is not set.
data-answer-cta-button-widthDefault is not set.
data-answer-cta-button-padding-xDefault is not set.
data-answer-cta-button-padding-yDefault is not set.
data-answer-cta-button-borderDefault is not set.
data-answer-cta-button-border-radiusDefault is not set.
data-answer-cta-button-bg-colorDefault is not set.
data-answer-cta-button-hover-bg-colorDefault is not set.
data-answer-cta-button-text-colorDefault is not set.
data-answer-cta-button-font-sizeDefault is not set.
data-answer-cta-button-box-shadowDefault is not set.

Example question button

ParameterDescription
data-example-question-button-heightDefault is not set.
data-example-question-button-widthDefault is not set.
data-example-question-button-padding-xDefault is not set.
data-example-question-button-padding-yDefault is not set.
data-example-question-button-borderDefault is not set.
data-example-question-button-border-radiusDefault is not set.
data-example-question-button-bg-colorDefault is not set.
data-example-question-button-hover-bg-colorDefault is not set.
data-example-question-button-text-colorDefault is not set.
data-example-question-button-font-sizeDefault is not set.
data-example-question-button-icon-sizeDefault is not set.
data-example-question-button-box-shadowDefault is "0px 1px 2px rgba(0, 0, 0, 0.1)".

Switch

ParameterDescription
data-switch-colorDefault is not set.
data-switch-borderDefault is not set.
data-switch-border-radiusDefault is not set.
data-switch-bg-colorDefault is not set.
data-switch-show-iconsDefault is "false".

Search mode

ParameterDescription
data-search-result-link-targetDefault is "_blank".
data-search-result-hover-bg-colorDefault is "#F1F1F1".
data-search-result-primary-text-colorDefault is the project color.
data-search-result-secondary-text-colorDefault is "#868e96".
data-search-result-primary-title-font-sizeDefault is "0.75rem".
data-search-result-secondary-title-font-sizeDefault is "0.75rem".
data-search-result-badge-bg-colorDefault is not set.
data-search-result-badge-text-colorDefault is not set.
data-search-show-more-button-text-colorDefault is project color.
data-search-show-more-button-hover-bg-colorDefault is not set.
data-search-ask-ai-cta-icon-colorDefault is the project color.
data-search-ask-ai-cta-text-colorDefault is the project color.
data-search-ask-ai-secondary-text-colorDefault is "#868e96".
data-search-ask-ai-cta-hover-bg-colorDefault is "#F1F1F1".
data-search-ask-ai-cta-text-font-sizeDefault is "xs" (0.75rem).
data-search-ask-ai-secondary-text-font-sizeDefault is "xs" (0.75rem).