DocSearchProps
TheDocSearchProps interface defines all configuration options for the DocSearch component. This is the primary interface used to configure search behavior, UI customization, AI features, and user interactions.
Required Properties
string
required
Algolia application ID used by the search client.
string
required
Public API key with search permissions for the index. This should be a search-only API key, never your admin API key.
Index Configuration
string
deprecated
Name of the Algolia index to query.Deprecated:
indexName will be removed in a future version. Please use the indices property going forward.Array<DocSearchIndex | string>
List of indices and optional search parameters to be used for search. This allows querying multiple indices or configuring per-index search parameters.See the indices documentation for more details.
SearchParamsObject
deprecated
Additional Algolia search parameters to merge into each query.Deprecated:
searchParameters will be removed in a future version. Please use the indices property going forward.AI Features
DocSearchAskAi | string
Configuration or assistant ID to enable Ask AI mode. Pass a string assistant ID for simple configuration, or a full config object for advanced options.See DocSearchAskAi configuration for detailed options.
(initialMessage: InitialAskAiMessage) => boolean | void
Intercept Ask AI requests (e.g., submitting a prompt or selecting a suggested question).Return
true to prevent the default modal Ask AI flow (no toggle, no sendMessage). This is useful to route Ask AI into a different UI (e.g., @docsearch/sidepanel-js) without flicker.UI Customization
DocSearchTheme
Theme overrides applied to the modal and related components.
string
Placeholder text for the search input.
DocSearchTranslations
Localized strings for the button and modal UI.
DocumentFragment | Element
The container element where the modal should be portaled to. Defaults to
document.body.DocSearchModalShortcuts
Configuration for keyboard shortcuts. Allows enabling/disabling specific shortcuts.Default:
{ 'Ctrl/Cmd+K': true, '/': true }Search Behavior
number
Maximum number of hits to display per source/group.
string
Query string to prefill when opening the modal.
({ query }: { query: string }) => string
Builds a URL to report missing results for a given query.
Custom Components
(items: DocSearchHit[]) => DocSearchHit[]
Hook to post-process hits before rendering. Use this to filter, sort, or modify search results.See DocSearchHit type for the hit structure.
(props, helpers?) => JSX.Element
Custom component to render an individual hit. Supports multiple template patterns:
- HTML strings with html helper:
(props, { html }) => html…“ - JSX templates:
(props) => <div>...</div> - Function-based templates:
(props) => string | JSX.Element | Function
Custom component rendered at the bottom of the results panel. Supports the same template patterns as
hitComponent.Advanced Configuration
(searchClient: DocSearchTransformClient) => DocSearchTransformClient
Hook to wrap or modify the Algolia search client. Useful for adding custom middleware, logging, or request modification.
Custom navigator for controlling link navigation. Use this to integrate with client-side routers or add custom navigation logic.
AutocompleteOptions<InternalDocSearchHit>['insights']
Insights client integration options to send analytics events. This allows tracking user interactions with search results.
User Personalization
boolean
Disable storage and usage of recent and favorite searches.
number
Limit of how many recent searches should be saved/displayed.Default:
7number
Limit of how many recent searches should be saved/displayed when there are favorited searches.Default:
4