0.1.4 • Published 3 years ago
@ecancan/react-generic-search-bar v0.1.4
React Generic Search Bar
This module is generic search bar component. Main purpose of this module is filter with just typing custom properties your item data.
Demo

Installation
With Yarn
yarn add @ecancan/react-generic-search-barWith Npm
npm install @ecancan/react-generic-search-barUsage
Basic
import { SearchBar } from '@ecancan/react-generic-search-bar';
<SearchBar<ItemsType>
items={items}
onResult={(_items) => console.log(_items)}
placeholderText={'Search and filter. Eg. /gender:male /species:alien ...'}
/>All props are optional. Actually no need any props for basic usage.
Advanced
import { SearchBar } from '@ecancan/react-generic-search-bar';
<SearchBar<ItemsType>
items={items}
onResult={(_items) => console.log(_items)}
onChange={(value) => console.log(value)}
buttonLabel={'Search...'}
styles={{containerStyle: styleValue, searchInputStyle: styleValue}}
placeholderText={'Search and filter. Eg. /gender:male /species:alien ...'}
/>All Props
| Prop Name | Necessity | Value Example | Value Type |
|---|---|---|---|
items | optional | Advanced | array |
buttonLabel | optional | Advanced | string |
placeholderText | optional | Advanced | string |
styles | optional | Advanced | SearchBarStyleProps |
onChange | optional | Advanced | ((value: string) => void) |
onResult | optional | Advanced | function |
Next Features
- Query string builder
- Openable type map modal with shortcut
- Type suggestion on searching (maybe autocomplete 😝)
How do you contribute
Git Clone
git clone https://github.com/Ecancan/ReactGenericSearchBar.gitInstall packages & Run
With Yarn
yarn install
yarn run storybookWith Npm
npm install
npm run storybookBuild
yarn run buildor
npm run buildNote
If you see any bug or issue please open a issue or send a contribution. Thank you for your time on this module. :)