> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.
# Ask AI chat panel
> Embed Fern's Ask AI chat panel in any React application, with a floating launcher, a bottom prompt, an inline button, or a custom trigger.
`AskAiChat` renders a sidebar panel with AI chat (no keyword search). It's one of the two components in the [`@fern-api/search-widget` package](/learn/docs/ai-features/search-widget/overview), which covers the prerequisites and the Content Security Policy the widget needs.
## Setup
#### Install the package
**`npm`**
```bash npm
npm install @fern-api/search-widget react@19 react-dom@19
```
**`pnpm`**
```bash pnpm
pnpm add @fern-api/search-widget react@19 react-dom@19
```
**`yarn`**
```bash yarn
yarn add @fern-api/search-widget react@19 react-dom@19
```
#### Render the chat
Import the component and the bundled styles, then render it with your docs domain. By default, the component renders its own trigger button, and citations in its answers link to your docs domain and open in a new tab. `cmd`/`ctrl` + `/` toggles the panel, and it becomes a bottom drawer below 768px.
Without `"use client"`, the page fails with `TypeError: createContext only works in Client Components`. A static import is enough: `next/dynamic` and `ssr: false` aren't required. The Pages Router, Vite, Create React App, and Remix need no additional configuration.
```tsx
// Required in the Next.js App Router
'use client';
import { AskAiChat } from '@fern-api/search-widget';
import '@fern-api/search-widget/styles';
export function AskAi() {
return ;
}
```
#### Match the chat to your product
`theme` controls light and dark mode, and `accentColor` sets the accent used for the sparkles, the send button, and links in answers, in both modes. `trigger` chooses between the corner launcher (`floating`), a prompt input centered at the bottom of the viewport (`prompt`), an unpainted button you place and style yourself (`inline`), and no button at all (`none`).
```tsx
```
## Custom triggers
#### Placing the trigger in a dropdown menu
A dropdown menu item can hold the trigger, but not the whole widget: selecting the item closes the menu, and most menu libraries unmount the menu's contents when it closes, destroying the chat before it renders.
Split the widget into `AskAiChat.Root`, `AskAiChat.Trigger`, and `AskAiChat.Panel` instead, keeping the trigger inside the menu and the chat outside it. The single `` component remains the normal integration.
```jsx
import { AskAiChat } from '@fern-api/search-widget';
import '@fern-api/search-widget/styles';
function HelpMenu() {
return (
HelpContact support
);
}
```
* `AskAiChat.Root` holds the state and takes the configuration props: `domain`, `lang`, `searchLocale`, `placement`, `theme`, `accentColor`, `open`, `defaultOpen`, and `onOpenChange`. Its `children` is the subtree to wrap, the menu and the panel.
* `AskAiChat.Trigger` is a real `