DocSearchSidepanel component provides an AI-powered chat interface in a sidepanel that can be integrated into your documentation site. It offers a more conversational way to interact with your documentation using Algolia’s Ask AI feature.
Import
Usage
Props
Required Props
The assistant ID to use for the Ask AI feature.
Public API key with search permissions for the index.
Algolia application ID used by the search client.
The index name to use for the Ask AI feature. Your assistant will search this index for relevant documents.
Configuration
Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.Object with optional properties:
'Ctrl/Cmd+I'(boolean): Enable/disable Ctrl/Cmd+I shortcut to toggle sidepanel
Theme overrides applied to the Sidepanel button and panel.
Search parameters for AI context retrieval.When
agentStudio is false or not set:facetFilters(string[]): Facet filters to applyfilters(string): Filter stringattributesToRetrieve(string[]): Attributes to retrieverestrictSearchableAttributes(string[]): Restrict searchable attributesdistinct(boolean | number | string): Distinct parameter
agentStudio is true, the object is keyed by index name.Experimental: Whether to use Agent Studio as the chat backend.This is an experimental feature and its API may change without notice in future releases. Use with caution in production environments.
Button Configuration
Props specific to the Sidepanel button.Object with optional properties:
variant(‘floating’ | ‘inline’, default: ‘floating’): Button positioning and stylingtranslations(SidepanelButtonTranslations): Button text translations
keyboardShortcuts prop is inherited from the root component.Panel Configuration
Props specific to the Sidepanel panel.Object with optional properties:
variant(‘inline’ | ‘floating’, default: ‘floating’): Panel positioningside(‘left’ | ‘right’, default: ‘right’): Side of the page the panel originates frompushSelector(string, default: ‘#root, main, .app, body’): CSS selector for elements to push when using inline variantwidth(number | string, default: ‘360px’): Panel widthexpandedWidth(number | string, default: ‘580px’): Panel width when expandedportalContainer(DocumentFragment | Element): Container element for portalsuggestedQuestions(boolean, default: false): Enable suggested questions displaytranslations(SidepanelTranslations): Panel-specific translations
Callbacks
Callback fired when the component is ready.
Callback fired when the modal or sidepanel opens.
Callback fired when the modal or sidepanel closes.
Callback fired specifically when the sidepanel opens.
Callback fired specifically when the sidepanel closes.
Button Variants
Floating Button (default)
The floating variant displays a button in the bottom-right corner of the screen with just the AI icon:Inline Button
The inline variant displays the button inline where it’s rendered with text:Panel Variants
Floating Panel (default)
The floating variant is positioned above all other content on the page:Inline Panel
The inline variant pushes page content when opened:Ref Methods
When usingReact.forwardRef, the component exposes a DocSearchRef object:
Opens the search modal (if integrated with DocSearch).
Closes the search modal (if integrated with DocSearch).
Opens the sidepanel programmatically.
Closes the sidepanel programmatically.
Example with Ref
Keyboard Shortcuts
By default, the sidepanel can be toggled with:- Ctrl/Cmd + I: Toggle sidepanel open/close
- Escape: Close sidepanel (when open)
keyboardShortcuts prop:
