Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docsearch.js

Package Overview
Dependencies
Maintainers
59
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docsearch.js

Library that packages DocSearch in a single function.

  • 3.0.0-beta.0
  • beta
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27K
decreased by-23.34%
Maintainers
59
Weekly downloads
 
Created
Source

DocSearch.js

Library that packages DocSearch in a single function.

Installation

npm install docsearch.js
# or
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 {
  /**
   * The container of the search box.
   */
  container: HTMLElement | string;
  /**
   * The text that appears in the search box input when there is
   * no query.
   *
   * @default `"Search"`
   */
  placeholder?: string;
  /**
   * The number of milliseconds before the search is considered
   * as stalled
   *
   * @default `300`
   */
  stalledSearchDelay?: number;
  /**
   * Function called when the user highlights an item.
   * Highlighting happens on hover and on keyboard navigation.
   */
  onItemHighlight?({ hit }: { hit: DocSearchHit }): void;
  /**
   * Function called when the user selects an item.
   */
  onItemSelect?({ hit }: { hit: DocSearchHit }): void;
}

FAQs

Package last updated on 21 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc