The UI required to use FIND-X search is provided by the ChatBox
component included in the npm package.
To use it, you need to import and add it into the root layout file of your application.
import { ChatBox } from "find-x-ai";
To implement the search functionality, include the component in your application:
app.jsx/tsx
layout.jsx/tsx
in the app directory import type { Metadata } from "next";
import "./globals.css";
/* Import the Chat component */
import { ChatBox } from "find-x-ai";
export const metadata: Metadata = {
title: "FIND-X Application",
description: "Powered by FIND-X Search",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>
{children}
<ChatBox
config={{
findx_key: process.env.NEXT_PUBLIC_FINDX_KEY!,
theme: "dark",
default: true
}}
/>
</body>
</html>
);
}
The ChatBox
component accepts a config
prop with the following properties:
findx_key
: Your FIND-X API keytheme
: Visual theme - either "dark"
or "light"
default
: Boolean value to control the visibility of the default trigger elementRestart your development server to see the changes take effect.