|
1 | 1 | # react-custom-search-list
|
2 |
| -A customizable React search input component with dynamic popup suggestions, allowing developers to create unique search experiences |
| 2 | + |
| 3 | +React Custom Search List is a powerful and flexible search input component for React. It allows developers to create a fully customizable suggestions list that can display regardless of the current input. The component enhances user experience by providing instant visual feedback through dynamic popups, enabling users to seamlessly type and select from tailored search suggestions. |
| 4 | + |
| 5 | +Whether you want to showcase a constant list of options or dynamically adapt to user inputs, React Custom Search List offers the versatility you need to deliver an engaging search experience. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Dynamic suggestions list |
| 10 | + |
| 11 | +- Responsive |
| 12 | + |
| 13 | +- Clear button |
| 14 | + |
| 15 | +- `Rtl` support |
| 16 | + |
| 17 | +- Flexible style |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +> $ npm install react-custom-search-list --save |
| 22 | +
|
| 23 | +or |
| 24 | + |
| 25 | +> $ yarn add react-custom-search-list |
| 26 | +
|
| 27 | +If you need to directly include script in your html, use the following links : |
| 28 | + |
| 29 | +```js |
| 30 | +<script src="https://unpkg.com/react-custom-search-list@latest/dist/react-custom-search-list.min.js"></script> |
| 31 | +``` |
| 32 | + |
| 33 | +## Minimal Usage |
| 34 | + |
| 35 | +```js |
| 36 | +import {useState} from 'react'; |
| 37 | +import ReactCustomSearchList from 'react-custom-search-list'; |
| 38 | +function App(){ |
| 39 | + const [searchValue, setSearchValue] = useState(''); |
| 40 | + return ( |
| 41 | + <ReactCustomSearchList fullWidth value={searchValue} setValue={setSearchValue}> |
| 42 | + /**Render your suggestions list here */ |
| 43 | + <ul> |
| 44 | + <li>Option A</li> |
| 45 | + <li>Option B</li> |
| 46 | + <li>Option C</li> |
| 47 | + </ul> |
| 48 | + </ReactCustomSearchList> |
| 49 | + ); |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +## Props |
| 54 | + |
| 55 | +- value |
| 56 | + - type : `String` |
| 57 | + - description : input value |
| 58 | +- setValue |
| 59 | + - type : `Func` |
| 60 | + - description : setState function for input value |
| 61 | +- children |
| 62 | + - type : `ReactNode` |
| 63 | + - description : suggestions list |
| 64 | +- rootStyle? |
| 65 | + - type : `Object` |
| 66 | + - description : style object of the `root` element |
| 67 | +- inputStyle? |
| 68 | + - type : `Object` |
| 69 | + - description : style object of the `input` element |
| 70 | +- placeholder? |
| 71 | + - type : `String` |
| 72 | + - default : `"search"` |
| 73 | +- iconsColor? |
| 74 | + - type : `String` |
| 75 | + - description : svg icon's color |
| 76 | + - default : `"gray"` |
| 77 | +- searchIconStyle? |
| 78 | + - type : `Object` |
| 79 | + - description : style object of the magnifying icon |
| 80 | +- clearIconStyle? |
| 81 | + - type : `Object` |
| 82 | + - description : style object of the clear icon |
| 83 | +- popperStyle? |
| 84 | + - type : `Object` |
| 85 | + - description : style object of the popper container |
| 86 | +- onKeyDown? |
| 87 | + - type : `Func` |
| 88 | + - description : keydown event for input |
| 89 | +- onBlur? |
| 90 | + - type : `Func` |
| 91 | + - description : blur event for input |
| 92 | +- fullWidth? |
| 93 | + - type : `Boolean` |
| 94 | + - description : set popper width same as input |
| 95 | +- placement? |
| 96 | + - type : `'auto'| 'auto-start'| 'auto-end'| 'top'| 'top-start'| 'top-end'| 'bottom'| 'bottom-start'| 'bottom-end'| 'right'| 'right-start'| 'right-end'| 'left'| 'left-start'| 'left-end'` |
| 97 | + - description : popper's placement |
| 98 | + |
| 99 | +## Test |
| 100 | + |
| 101 | +> $ npm run test |
| 102 | +
|
| 103 | +## License |
| 104 | + |
| 105 | +MIT |
0 commit comments