widget.js once, in an effect, and destroys the assistant when it unmounts. It is safe to import in server-rendered code.
Public door
SearchBar.tsx
Per-user door
Pass the token your server opened, and a function that opens a new one.Assistant.tsx
"use client" line is for Next.js App Router. Other setups ignore it. For the server route, see Per-user door.
How props behave
Where it renders
launcher="bubble"(default): the bubble floats in the bottom-right corner. The component renders nothing in place.launcher="bar": the component renders a<div>and the bar inside it. Size and place it withclassNameorstyle. The bar is 42px high and fills the width of that<div>.
Errors
onError receives an Error when widget.js fails to load (offline, blocked by a CSP or an ad blocker) or when the options are invalid. Without onError, the component logs to console.error. It never throws during render.
Server-side rendering
Nothing runs on the server. The component renders an empty<div> (bar) or nothing (bubble), then loads the assistant in the browser.
All props are listed in the React reference.