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

react-search-box

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-search-box

An autocomplete search box for ReactJS

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-18.6%
Maintainers
1
Weekly downloads
 
Created
Source

react search box

npm bundle size NPM npm npm Edit on Codesandbox

Installation

# npm
npm i react-search-box --save

# yarn
yarn add react-search-box

Usage

import React, { Component } from "react";
import ReactSearchBox from "react-search-box";

export default class App extends Component {
  data = [
    {
      key: "john",
      value: "John Doe",
    },
    {
      key: "jane",
      value: "Jane Doe",
    },
    {
      key: "mary",
      value: "Mary Phillips",
    },
    {
      key: "robert",
      value: "Robert",
    },
    {
      key: "karius",
      value: "Karius",
    },
  ];

  render() {
    return (
      <ReactSearchBox
        placeholder="Placeholder"
        value="Doe"
        data={this.data}
        callback={(record) => console.log(record)}
      />
    );
  }
}

Props

PropDescription
placeholderThe placeholder text for the input box
dataAn array of objects which acts as the source of data for the dropdown. This prop is required
fuseConfigsConfigs to override default Fuse configs
autoFocusFocus on the input box once the component is mounted
clearOnSelectClear the input value when any record is selected
onSelectA function which acts as a callback when any record is selected. It is triggered once a dropdown item is clicked
onFocusA function which acts as a callback when the input is focussed
onChangeA function which acts as a callback when the input value is changed
inputFontColorColor of the text in the input box
inputBorderColorColor of the border of the input box
inputFontSizeSize of the font of the input box
inputHeightHeight of the input box
inputBackgroundColorBackground color of the input box
dropDownHoverColorBackground color on hover of the dropdown list items
dropDownBorderColorBorder color of the dropdown
leftIconIcon to be rendered on the left of the input box
iconBoxSizeThe size of the icon (based on the leftIcon prop)
typeThe type of the input

Built With

  • React - A JavaScript library for building user interfaces
  • Fuse - Lightweight fuzzy-search library. Zero dependencies.
  • Styled components - Visual primitives for the component age.

License

MIT Licensed. Copyright (c) Nirmalya Ghosh 2021.

FAQs

Package last updated on 07 Feb 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