https://github.com/dev-javascript/react-custom-search-list
A customizable React search input component with dynamic popup suggestions, allowing developers to create unique search experiences
https://github.com/dev-javascript/react-custom-search-list
autocomplete custom-autocomplete custom-search custom-suggestions customizable dynamic-suggestions frontend interactive-search popup-suggestions react react-component react-responsive-search react-search react-searchbox responsive search search-input suggestions ui-component user-experience
Last synced: about 2 months ago
JSON representation
A customizable React search input component with dynamic popup suggestions, allowing developers to create unique search experiences
- Host: GitHub
- URL: https://github.com/dev-javascript/react-custom-search-list
- Owner: dev-javascript
- License: mit
- Created: 2024-11-18T01:01:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-14T13:36:16.000Z (11 months ago)
- Last Synced: 2025-05-30T12:58:25.660Z (7 months ago)
- Topics: autocomplete, custom-autocomplete, custom-search, custom-suggestions, customizable, dynamic-suggestions, frontend, interactive-search, popup-suggestions, react, react-component, react-responsive-search, react-search, react-searchbox, responsive, search, search-input, suggestions, ui-component, user-experience
- Language: JavaScript
- Homepage:
- Size: 1.96 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# react-custom-search-list
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.
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.
## Demo
- [Online Demo](https://dev-javascript.github.io/react-custom-search-list/)
## Features
- Custom suggestions list
- Responsive
- Multi Themes
- Clear button
- Rtl support
- Flexible style
- Lightweight
- autoFocus
## Installation
> $ npm install react-custom-search-list @popperjs/core --save
or
> $ yarn add react-custom-search-list @popperjs/core
If you need to directly include script in your html, use the following links :
```js
```
#### NOTE:
> Please note that `@popperjs/core` is peer dependency, meaning you should ensure it is installed before installing `react-custom-search-list`.
## Minimal Usage
```js
import {useState} from 'react';
import 'react-custom-search-list/style/react-custom-search-list.min.css';
import ReactCustomSearchList from 'react-custom-search-list';
function App() {
const [value, setValue] = useState('');
return (
setValue(e.target.value)}
onClear={() => setValue('')}>
{/**Render your suggestions list here*/}
- Option A
- Option B
- Option C
);
}
```
## Props
- **value**
- type : `String`
- description : input value
- **onChange**
- type : `Func`
- description : onChange Handler for the input value
- **onClear?**
- type : `Func`
- description : triggered when the user clicks on the Clear icon
- **theme?**
- type : `"outline"|"underline"|"panel"`
- description : searchbox theme
- default : `"outline"`
- **autoFocus?**
- type : `Boolean`
- default : `Fasle`
- **children**
- type : `ReactNode`
- description : suggestions list
- **openOnClick?**
- type :`Boolean`
- description : if it is true then the suggestion list will be open when the user clicks on the input
- default : `True`
- **openOnKeyDown?**
- type : `(e) => Boolean`
- description : if it returns true then the suggestion list will be open
- default : `(e) => e.key === "Enter"`
- **rootStyle?**
- type : `Object`
- description : style object of the `root` element
- **inputContainerStyle?**
- type: `Object`
- description : style object of the parent element of text input
- **inputStyle?**
- type : `Object`
- description : style object of the `input` element
- **placeholder?**
- type : `String`
- default : `"search"`
- **popperStyle?**
- type : `Object`
- description : style object of the popper container
- **onKeyDown?**
- type : `Func`
- description : keydown event for input
- **onFocus?**
- type : `Func`
- description : focus event for input
- **onBlur?**
- type : `Func`
- description : blur event for input
- **fullWidth?**
- type : `Boolean`
- description : set popper width same as input ( if the `theme` option is equal to `"panel"` then `fullWidth` option will not work )
- default: `true`
- **placement?**
- 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'`
- description : popper's placement
- default : `bottom-start`
- **ClearIconComponent?**
- type : `React function component`
- description : custom Clear icon
- **MagnifierIconComponent?**
- type : `React function component`
- description : custom Magnifier icon
- **inputName?**
- type : `String`
- description : name attribute for the input element
- default : `""`
- **corner?**
- type : `Boolean`
- description : if it is true then the search box gets border-radius
- default : `True`
## Test
> $ npm run test
## License
MIT