DocSearch.js
Library that packages DocSearch in a single function.
Installation
npm install docsearch.js
yarn add docsearch.js
Usage
docsearch({
indexName: 'YOUR_INDEX_NAME',
apiKey: 'YOUR_API_KEY',
container: 'input[type="search"]',
});
API
docsearch(options)
docsearch({
container,
placeholder,
stalledSearchDelay,
onItemSelect,
onItemHighlight,
}: DocSearchOptions);
interface DocSearchOptions extends DocSearchCoreOptions {
container: HTMLElement | string;
placeholder?: string;
stalledSearchDelay?: number;
onItemHighlight?({ hit }: { hit: DocSearchHit }): void;
onItemSelect?({ hit }: { hit: DocSearchHit }): void;
}