Giter VIP home page Giter VIP logo

react-search-box's Introduction

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

Prop Description
placeholder The placeholder text for the input box
data An array of objects which acts as the source of data for the dropdown. This prop is required
fuseConfigs Configs to override default Fuse configs
autoFocus Focus on the input box once the component is mounted
clearOnSelect Clear the input value when any record is selected
onSelect A function which acts as a callback when any record is selected. It is triggered once a dropdown item is clicked
onFocus A function which acts as a callback when the input is focussed
onChange A function which acts as a callback when the input value is changed
inputFontColor Color of the text in the input box
inputBorderColor Color of the border of the input box
inputFontSize Size of the font of the input box
inputHeight Height of the input box
inputBackgroundColor Background color of the input box
dropDownHoverColor Background color on hover of the dropdown list items
dropDownBorderColor Border color of the dropdown
leftIcon Icon to be rendered on the left of the input box
iconBoxSize The size of the icon (based on the leftIcon prop)
type The 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.

react-search-box's People

Contributors

dependabot[bot] avatar ghoshnirmalya avatar greenkeeper[bot] avatar jimbob687 avatar pl4nty avatar rowenaravenclawwithextraclaws avatar snyk-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.