
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
reactjs-autocomplete
Advanced tools
Accessible, customizable, and easy to implement , autocomplete search input for react
import { AutoComplete } from 'reactjs-autocomplete';
<AutoComplete
list={[1, 'one', 2, 'two', 3, 'three']}
handleHighlight={(highlightedItem) => {
console.log(highlightedItem)
}}
onSelect={(selectedItem) => {
console.log(selectedItem)
}}
/>
npm install --save reactjs-autocomplete
list: arrayarray of the values to be searched for a match to the user inputgetDisplayValue is needed if list array contains objectsgetDisplayValue: function (Optional)list contains objectsfunction used to filter out the property value to be displayed in the dropdown<AutoComplete
list={[
{ name: 'Tom', id: 3233 },
{ name: 'Tommy', id: 3445 },
{ name: 'Thomas', id: 3663 }
]}
getDisplayValue={(list) => {
return list.map((listItem) => listItem.name)
}}
/>
handleHighlight: function (Optional)highlighted item changeshighlighted item's value from the original listhighlighted item is a property value from an object, the whole object is passed inonSelect: function (Optional)selected item's value from the original listselected item is a property value from an object, the whole object is passed inhandleNewValue: function (Optional)onSelect when there is no matching value for the text inputonSelect function will run with the text input being its only argument import { AutoComplete } from 'reactjs-autocomplete';
<AutoComplete
list={[1, 'one', 2, 'two', 3, 'three']}
onSelect={(selectedItem) => {
console.log(selectedItem)
}}
handleNewValue={(inputValue) => {
console.log(inputValue)
}}
/>
onSelectError: function (Optional)onSelect fires when there is no match for the input value and the handleNewValue function is not passed innoMatchMessage: string (Optional)default - will show no message<AutoComplete
onSelectError={() => window.alert("TRY AGAIN")}
noMatchMessage={"No matches found"}
/>
open : boolean (Optional)true opens the dropdown and false closes the dropdownonDropDownChange: function (Optional) const [openDropDown, setOpenDropDown] = useState()
const toggleDropDown = () => {
setOpenDropDown(openDropDown ? false : true)
}
return(
<>
<button className='ignore' onClick={toggleDropDown} />
<AutoComplete
onDropDownChange={(isOpen) => setOpenDropDown(isOpen)}
open={openDropDown}
/>
</>
)
disableOutsideClick : boolean (Optional)false (default) the dropdown closes when mouse is clicked outside of the auto-complete wrapper divtrue will disable the featureclassName of ignoreinputProps: Object (Optional) <AutoComplete
inputProps={{
placeholder: "search...",
onMouseOver: () => setOpenDropDown(true)
}}
showAll={true}
highlightFirstItem={false}
/>
showAll: boolean (Optional)false (default) dropdown doesn't appear until input value matches an item's prefixtrue - If the input is focused and empty the dropdown displays all list itemshighlightFirstItem: boolean (Optional)true (default) - automatically highlights first item in dropdownfalse - highlight is hidden until arrow key is pressed or hover with mousesubmit : boolean (Optional)controlSubmit to only fire onSelect or handleNewValue when passed in as truecontrolSubmit: boolean (Optional)true, onSelect and handleNewValue will only fire when submit is passed in as true const [submit, setSubmit] = useState(false);
const toggleSubmit = (() => {
setSubmit(true)
})
return(
<>
<button className='ignore' onClick={toggleSubmit}>SUBMIT</button>
<AutoComplete
controlSubmit={true}
submit={submit}
onSelect={(selectedItem) => {
console.log(selectedItem)
setSubmit(false)
}}
/>
</>
)
wrapperStyle: Object (Optional)div wrapping the whole componentautocomplete-wrapperinputStyle: Object (Optional)input elementautocomplete-inputdropDownStyle: Object (Optional)divdropdown-containerlistItemStyle: Object (Optional)item div in the dropdowndropdown-itemhighlightedItemStyle: Object (Optional)highlighted itemhighlighted-item <AutoComplete
highlightedItemStyle={{
backgroundColor: "dodgerBlue"
}}
listItemStyle={{
cursor: "pointer",
padding: "5px"
}}
dropDownStyle={{
backgroundColor: "antiquewhite",
width: "215px"
}}
/>
Add to the tests: src/AutoComplete.test.js
Run the tests: npm test
In the project directory, you can run:
npm startRuns the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
npm testLaunches the test runner in the interactive watch mode.
FAQs
Accessible, customizable, and easy to implement , autocomplete search input for react
We found that reactjs-autocomplete demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.