Sidepanel API Reference
appIdโ
type: string| required
Your Algolia application ID.
apiKeyโ
type: string| required
Your Algolia Search API key.
assistantIdโ
type: string| required
The ID for which Ask AI assistant to use.
indexNameโ
type: string| required
The name of the index to be used with the Ask AI service.
agentStudioโ
type: boolean| optional | experimental
agentStudio is currently an experimental property. It is targeted to be stable in release 5.0.0.
If agentStudio is true, the Ask AI chat will use Algolia's Agent Studio as the chat backend instead of the Ask AI backend. More can be learned about setting up Agent Studio on their dedicated documentation page.
searchParametersโ
variantโ
type: 'floating' | 'inline'| default:'floating'| optional
Variant of the Sidepanel positioning.
inlinepushes page content when opened.floatingis positioned above all other content on the page.
sideโ
type: 'right' | 'left'| default:'right'| optional
The side of the page which the panel will originate from.
widthโ
type: number | string| default:'360px'| optional
Width of the Sidepanel (px or any CSS width) while in it's default state.
expandedWidthโ
type: number | string| default:'580px'| optional
Width of the Sidepanel (px or any CSS width) while in it's expanded state.
suggestedQuestionsโ
type: boolean| default:false| optional
Enables displaying suggested questions on new conversation screen.
More information on setting up Suggested Questions can be found on Algolia Docs
keyboardShortcutsโ
type: { 'Ctrl/Cmd+I': boolean }| optional
Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.
Default behavior:โ
Ctrl/Cmd+I- Opens and closes the Sidepanel
Interface:โ
interface SidepanelShortcuts {
'Ctrl/Cmd+I'?: boolean; // default: true
}
themeโ
type: 'light' | 'dark'| default:'light'| optional
portalContainer (React only)โ
type: Element | DocumentFragment| default:document.body| optional
The container element where the panel should be portaled to. Use this when you need the Sidepanel to render in a custom DOM node.
This prop only exists in the React based versions of Sidepanel. If you are using the @docsearch/sidepanel-js package, use the container option instead.
- React
- JavaScript
// assume you have a dedicated DOM node in your HTML
<div id="sidepanel-root" />
const portalEl = document.getElementById('sidepanel-root');
<Sidepanel
appId="YOUR_APP_ID"
apiKey="YOUR_SEARCH_API_KEY"
assistantId="YOUR_ASSISTANT_ID"
indexName="YOUR_INDEX_NAME"
// Render the Sidepanel inside of #sidepanel-root instead of document.body
portalContainer={portalEl}
/>
sidepanel({
// The element that will contain the Sidepanel Button and Sidepanel
container: '#sidepanel-root',
indexName: 'YOUR_INDEX_NAME',
appId: 'YOUR_APP_ID',
apiKey: 'YOUR_SEARCH_API_KEY',
assistantId: 'YOUR_ASSISTANT_ID',
})