Skip to main content
The 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

string
required
The assistant ID to use for the Ask AI feature.
string
required
Public API key with search permissions for the index.
string
required
Algolia application ID used by the search client.
string
required
The index name to use for the Ask AI feature. Your assistant will search this index for relevant documents.

Configuration

SidepanelShortcuts
default:"{ 'Ctrl/Cmd+I': true }"
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
'light' | 'dark'
default:"'light'"
Theme overrides applied to the Sidepanel button and panel.
AskAiSearchParameters | AgentStudioSearchParameters
Search parameters for AI context retrieval.When agentStudio is false or not set:
  • facetFilters (string[]): Facet filters to apply
  • filters (string): Filter string
  • attributesToRetrieve (string[]): Attributes to retrieve
  • restrictSearchableAttributes (string[]): Restrict searchable attributes
  • distinct (boolean | number | string): Distinct parameter
When agentStudio is true, the object is keyed by index name.
boolean
default:"false"
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

SidepanelButtonProps
Props specific to the Sidepanel button.Object with optional properties:
  • variant (‘floating’ | ‘inline’, default: ‘floating’): Button positioning and styling
  • translations (SidepanelButtonTranslations): Button text translations
Note: keyboardShortcuts prop is inherited from the root component.

Panel Configuration

SidepanelProps
Props specific to the Sidepanel panel.Object with optional properties:
  • variant (‘inline’ | ‘floating’, default: ‘floating’): Panel positioning
  • side (‘left’ | ‘right’, default: ‘right’): Side of the page the panel originates from
  • pushSelector (string, default: ‘#root, main, .app, body’): CSS selector for elements to push when using inline variant
  • width (number | string, default: ‘360px’): Panel width
  • expandedWidth (number | string, default: ‘580px’): Panel width when expanded
  • portalContainer (DocumentFragment | Element): Container element for portal
  • suggestedQuestions (boolean, default: false): Enable suggested questions display
  • translations (SidepanelTranslations): Panel-specific translations

Callbacks

() => void
Callback fired when the component is ready.
() => void
Callback fired when the modal or sidepanel opens.
() => void
Callback fired when the modal or sidepanel closes.
() => void
Callback fired specifically when the sidepanel opens.
() => void
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 using React.forwardRef, the component exposes a DocSearchRef object:
function
Opens the search modal (if integrated with DocSearch).
function
Closes the search modal (if integrated with DocSearch).
function
Opens the sidepanel programmatically.
function
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)
Keyboard shortcuts can be disabled via the keyboardShortcuts prop:

Translations

The sidepanel supports comprehensive translations:

Types

SidepanelButtonProps

SidepanelProps

DocSearchSidepanelProps