0.0.49 • Published 8 months ago

@mintlify/widget v0.0.49

Weekly downloads
-
License
Elastic-2.0
Repository
-
Last release
8 months ago

Mintlify Widget

The Mintlify chat widget

Getting started

First you'll need to get an API key by visiting the Mintlify dashboard and generating a new API key.

Installation

You can add the widget by copy-pasting these script tags into your site's <head>...<head/> tag.

<script>
    window.mintlifyWidgetSettings = {
        connection: {
            apiKey: 'Your API key here'
        },
    };
</script>
<script>
    (function () {
        if (!document.getElementById('mintlify-widget')) {
            var script = document.createElement('script');
            script.id = 'mintlify-widget';
            script.src = 'https://unpkg.com/@mintlify/widget@^0';
            script.onload = () => MintlifyWidget.init();
            document.head.appendChild(script);
        }
    })();
</script>

To use the widget in React and Next.js apps, please check out the React component from the @mintlify/widget-react package on NPM.

Usage

In the first script tag, you can customize the appearance and other settings of the widget. mintlifyWidgetSettings accepts the following props:

PropTypeDescription
connectionMintlifyWidgetConnectionPropsInformation needed to connect to our API. Required.
display?MintlifyWidgetDisplayPropsConfigurations for the widget appearance and interactions.
tracking?MintlifyWidgetTrackingFunctionsCallback functions for tracking analytics.

MintlifyWidgetConnectionProps

PropTypeDescription
apiKeystringWidget API key generated from Mintlify dashboard. Required.

MintlifyWidgetDisplayProps

PropTypeDescription
trigger?MintlifyWidgetDisplayTriggerPropsAppearance of the trigger.
colors?MintlifyWidgetDisplayColorsPropsColors used across the widget.
chat?MintlifyWidgetDisplayChatPropsConfigs specific to AI chat.
isDarkMode?booleanControlled dark mode appearance. Defaults to OS preference.

MintlifyWidgetDisplayTriggerProps

PropTypeDescription
type?'button'|'input'Type of the trigger to display. Defaults to button.
label?stringLabel displayed in the trigger. Defaults to Get help for the button trigger and Ask anything... for the input trigger.
buttonIcon?'chat'|'sparkles'|'mintlify'Icon used in the trigger. Only available for the button trigger. Defaults to chat.
iconOnly?booleanOnly show icon in the trigger or not. Defaults to false.

Here is an overview of what the trigger looks like with different configurations.

type='input'
image
type='button''chat''sparkles''mintlify'
iconOnly=falseimageimageimage
iconOnly=trueimageimageimage

MintlifyWidgetDisplayColorsProps

PropTypeDescription
primary?stringPrimary color used in the widget. Defaults to #0D9373.
primaryLight?stringPrimary color in dark mode. Defaults to #55D799.

MintlifyWidgetDisplayChatProps

PropTypeDescription
openCitationInSameTab?booleanOpen the citation url in the same tab or not. Defaults to false.
exampleQueries?string[]Example queries to prompt the user to ask. Defaults to [].

MintlifyWidgetTrackingFunctions

PropTypeDescription
trackChatEnter()=> voidTriggered when the user opens the chat widget.
trackCitationClick(title: string, url: string)=> voidTriggered when the user clicks on a citation.
trackChatThumbsUp(query: string, response: string)=> voidTriggered when the user thumbs up on a response.
trackChatThumbsDown(query: string, response: string)=> voidTriggered when the user thumbs down on a response.
trackChatFollowup(query: string)=> voidTriggered when the user asks a question.
trackChatClose(queriesCount: number)=> voidTriggered when the user exits the chat widget.

Questions and Support

If you have any questions or need support on using the widget, please reach out to us via support@mintlify.com.

If you're new to Mintlify, sign up today at mintlify.com.

0.0.49

8 months ago

0.0.46

8 months ago

0.0.47

8 months ago

0.0.48

8 months ago

0.0.45

8 months ago

0.0.42

8 months ago

0.0.43

8 months ago

0.0.44

8 months ago

0.0.41

8 months ago

0.0.40

8 months ago

0.0.37

8 months ago

0.0.38

8 months ago

0.0.39

8 months ago

0.0.34

9 months ago

0.0.35

9 months ago

0.0.36

9 months ago

0.0.33

9 months ago

0.0.32

9 months ago

0.0.31

9 months ago

0.0.30

9 months ago

0.0.29

9 months ago

0.0.28

9 months ago

0.0.27

9 months ago

0.0.26

9 months ago

0.0.25

9 months ago

0.0.24

9 months ago

0.0.23

10 months ago

0.0.22

10 months ago

0.0.21

10 months ago

0.0.20

10 months ago

0.0.19

10 months ago

0.0.18

10 months ago

0.0.17

10 months ago

0.0.16

10 months ago

0.0.15

10 months ago

0.0.14

11 months ago

0.0.13

11 months ago

0.0.12

11 months ago

0.0.11

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago