
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
evergreen-autocomplete
Advanced tools
This package implements a Autocomplete component. This component only deals with rendering the list, not the actual input element.

evergreen-popover for the popover<Autocomplete onChange={handleChange} items={items}>
{({ key, getInputProps, getRef }) => (
<TextInput key={key} innerRef={ref => getRef(ref)} {...getInputProps()} />
)}
</Autocomplete>
static propTypes = {
items: PropTypes.array.isRequired,
selectedItem: PropTypes.any,
defaultSelectedItem: PropTypes.any,
children: PropTypes.func.isRequired,
itemSize: PropTypes.number,
renderItem: PropTypes.func,
itemsFilter: PropTypes.func,
isFilterDisabled: PropTypes.bool,
popoverMinWidth: PropTypes.number,
popoverMaxHeight: PropTypes.number,
useSmartPositioning: PropTypes.bool,
...Downshift.propTypes,
}
static defaultProps = {
itemToString: i => (i == null ? '' : String(i)),
itemSize: 32,
itemsFilter: fuzzyFilter,
isFilterDisabled: false,
popoverMinWidth: 200,
popoverMaxHeight: 240,
useSmartPositioning: false,
renderItem: autocompleteItemRenderer,
}
import { storiesOf } from '@storybook/react'
import React from 'react'
import Box from 'ui-box'
import starWarsNames from 'starwars-names'
import { TextInput } from 'evergreen-text-input'
import { Autocomplete } from '../src/'
// Generate a big list of items
const items = [
...starWarsNames.all,
...starWarsNames.all.map(x => `${x} 2`),
...starWarsNames.all.map(x => `${x} 3`)
].sort((a, b) => {
const nameA = a.toUpperCase()
const nameB = b.toUpperCase()
if (nameA < nameB) {
return -1
}
if (nameA > nameB) {
return 1
}
return 0
})
const handleChange = selectedItem => {
console.log(selectedItem)
}
storiesOf('autocomplete', module).add('Autocomplete', () => (
<Box padding={40}>
{(() => {
document.body.style.margin = '0'
document.body.style.height = '100vh'
})()}
<Autocomplete onChange={handleChange} items={items}>
{({ key, getInputProps, getRef }) => (
<TextInput
key={key}
innerRef={ref => getRef(ref)}
{...getInputProps()}
/>
)}
</Autocomplete>
</Box>
))
FAQs
React components: Autocomplete
We found that evergreen-autocomplete demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.