• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎨 An autocomplete search box built with and for React

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.

More Repositories

1

nextjs-strapi-boilerplate

🎨 Boilerplate for building applications using Strapi and Next.js
TypeScript
313
star
2

nirmalyaghosh.com

A personal portfolio built using Next.js, Chakra UI, SEO, MDX, and TypeScript
MDX
296
star
3

nextjs-hasura-boilerplate

🎨 Boilerplate for building applications using Hasura and Next.js
TypeScript
291
star
4

writy

Generate beautiful HTML files without writing any code. Still in beta!
TypeScript
100
star
5

linkedin-clone-react-frontend

πŸš€ Frontend for a software similar to LinkedIn
JavaScript
66
star
6

nextjs-hasura-trello-clone

A clone of Trello built using Hasura and Next.js
TypeScript
61
star
7

reddit-clone

⬆️ ⬇️ This is a sample application for building a clone of Reddit using React and Firebase
JavaScript
55
star
8

product-hunt-clone-using-nextjs-and-hasura

🎨 Accompanying project for "Building a Product Hunt clone app using Hasura and Next.js" tutorial on LogRocket blog
JavaScript
53
star
9

building-monorepos-using-lerna

πŸ‰ Sample application which shows how to build monorepos using Lerna
JavaScript
51
star
10

user-profile-in-php-and-mysql

A simple user profile page using PHP and MySQLi
JavaScript
31
star
11

nextjs-authentication-using-strapi-and-next-auth

Application show how Next.js can be authenticated using Strapi and NextAuth.
JavaScript
24
star
12

linkedin-clone-rails-backend

πŸš€ API to power a software similar to LinkedIn
Ruby
16
star
13

building-redux-from-scratch

Building Redux from scratch
JavaScript
16
star
14

social-app-api-in-elixir

Elixir
15
star
15

testing-next.js-apps

End to End for Next.js apps
JavaScript
13
star
16

twitter-clone-using-nextjs-and-prisma

🎨 Accompanying project for "Building a Twitter clone app using Prisma and Next.js" tutorial
TypeScript
13
star
17

screenshot-mockup

An app to generate mockups based on your images.
TypeScript
10
star
18

user-profile-using-php-and-mysqli

JavaScript
10
star
19

the-fullstack-app

Demo of a fullstack app using Next.js, Prisma, and NextAuth.
TypeScript
7
star
20

nextjs-graphcms

Sample application built using GraphCMS, Next.js and TailwindCSS
JavaScript
7
star
21

astro-md

Markdown blog using Astro
CSS
6
star
22

product-hunt-clone-using-strapi-react-next-docker

TypeScript
6
star
23

forum-script-using-php-and-mysql

PHP
5
star
24

build-components-using-tailwind

CSS
3
star
25

introduction-to-msw

JavaScript
3
star
26

feedback

Collect feedback for your designs.
TypeScript
2
star
27

gatsby-tailwind-minimal-starter

A starter template for building JAMStack apps using Gatsby and Tailwind CSS
TypeScript
2
star
28

crank.js-tailwind-css

Sample application built using Crank.js and TailwindCSS
JavaScript
2
star
29

nextjs-react-query-faunadb

🎨 Boilerplate for building applications using Fauna, React Query and Next.js
TypeScript
2
star
30

moon.js-tailwind-css

Sample application built using Moon.js and TailwindCSS
JavaScript
1
star
31

astro-docs-example

CSS
1
star
32

react-buttercms-storybook

JavaScript
1
star
33

prisma-next.js

Sample application built using Prisma and Next.js.
JavaScript
1
star
34

react-pagination-box

A pagination component built using React.js
TypeScript
1
star