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

@docsearch/react

Package Overview
Dependencies
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docsearch/react

React package for DocSearch, the best search experience for docs.

  • 3.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
457K
decreased by-19.71%
Maintainers
3
Weekly downloads
 
Created

What is @docsearch/react?

@docsearch/react is a React component library that provides a search interface for documentation websites. It leverages Algolia's DocSearch to offer a fast and efficient search experience.

What are @docsearch/react's main functionalities?

Basic Search Implementation

This feature allows you to integrate a basic search interface into your React application. You need to provide your Algolia app ID, API key, and index name.

import { DocSearch } from '@docsearch/react';

function App() {
  return (
    <DocSearch
      appId="YOUR_APP_ID"
      apiKey="YOUR_API_KEY"
      indexName="YOUR_INDEX_NAME"
    />
  );
}

Customizing Search Box

This feature allows you to customize the search box, including placeholder text and button translations, to better fit the design and language of your application.

import { DocSearch } from '@docsearch/react';

function CustomSearch() {
  return (
    <DocSearch
      appId="YOUR_APP_ID"
      apiKey="YOUR_API_KEY"
      indexName="YOUR_INDEX_NAME"
      placeholder="Search documentation..."
      translations={{
        button: {
          buttonText: 'Search',
          buttonAriaLabel: 'Search'
        }
      }}
    />
  );
}

Handling Search Events

This feature allows you to handle search events, such as input changes, to perform custom actions like logging the search query or triggering other functions.

import { DocSearch } from '@docsearch/react';

function SearchWithEvents() {
  const handleSearchInput = (query) => {
    console.log('Search query:', query);
  };

  return (
    <DocSearch
      appId="YOUR_APP_ID"
      apiKey="YOUR_API_KEY"
      indexName="YOUR_INDEX_NAME"
      onInput={handleSearchInput}
    />
  );
}

Other packages similar to @docsearch/react

FAQs

Package last updated on 24 May 2023

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