Files
DocsGPT/docs/pages/Extensions/react-widget.md
Alex 54baf04a86 Merge pull request #658 from RDxR10/main
Update react-widget.md
2023-10-23 11:56:03 -04:00

1.1 KiB

How to set up react docsGPT widget on your website:

Installation

Go to your project and install a new dependency: npm install docsgpt.

Usage

Go to your project and in the file where you want to use the widget, import it:

import { DocsGPTWidget } from "docsgpt";
import "docsgpt/dist/style.css";

Then you can use it like this: <DocsGPTWidget />

DocsGPTWidget takes 3 props:

  1. apiHost — URL of your DocsGPT API.
  2. selectDocs — documentation that you want to use for your widget (e.g. default or local/docs1.zip).
  3. apiKey — usually it's empty.

How to use DocsGPTWidget with Nextra (Next.js + MDX)

Install your widget as described above and then go to your pages/ folder and create a new file _app.js with the following content:

import { DocsGPTWidget } from "docsgpt";
import "docsgpt/dist/style.css";

export default function MyApp({ Component, pageProps }) {
    return (
        <>
            <Component {...pageProps} />
            <DocsGPTWidget selectDocs="local/docsgpt-sep.zip/"/>
        </>
    )
}