Ask AI assistant widget for Next.js
Add an AI assistant or AI search widget to your Next.js site.
Prerequisites
- A Biel.ai account. If you don't have one, sign up for free.
- A project created in your Biel.ai dashboard. Follow the Quickstart guide to create one.
- A Next.js application ready to install Biel.ai.
- Node.js installed.
Add the assistant widget

-
Install the Biel.ai package:
npm install biel-reactinfoIf you're using yarn as your package manager, run
yarn add biel-reactinstead of the npm command above. -
Create a wrapper for the assistant by creating a file at
components/biel-search.tsx:'use client';import { useEffect, type ComponentProps } from 'react';import { BielButton } from 'biel-react';import { defineCustomElements } from 'biel-search/loader';import 'biel-search/dist/biel-search/biel-search.css';const DynamicBielButtonComponent = (props: ComponentProps<typeof BielButton>) => {useEffect(() => {defineCustomElements(window);}, []);return <BielButton {...props} />;};export default DynamicBielButtonComponent; -
Create
components/DocumentationChat.tsxfor the browser-only widget entry point:'use client'import dynamic from 'next/dynamic';const DynamicBielButton = dynamic(() => import('@/components/biel-search'), {ssr: false,});export default function DocumentationChat() {return (<div className="App">{/* Other components and content */}<DynamicBielButtonproject="<YOUR_PROJECT_ID>"header-title="Biel.ai assistant"button-position="bottom-right"modal-position="bottom-right"button-style="dark">Ask AI</DynamicBielButton></div>);}Replace
<YOUR_PROJECT_ID>with your project's ID from the Biel.ai dashboard. -
Import
DocumentationChatin your existingapp/layout.tsxorpages/_app.tsxand render<DocumentationChat />alongside the existing page content. Keep your root layout's<html>,<body>, and metadata. The client boundary belongs inDocumentationChat, not the root layout. -
Run
npm run devand verify that the assistant appears and works on your site.
Next steps
- Customize the widget's appearance, behavior, and tone.
- Connect integrations like GitHub Actions, MCP, or Zapier.