react-select-virtualized

react-select v3 + react-virtualized + react hooks!

This project came up after hours of trying to find an autocomplete component that supports large sets of data to be displayed and searched for while maintain performance. The only libraries out there that allow this functionality are either not maintained anymore, use outdated libraries or are poorly performant.
I created a component that uses the Airbnb library called react-virtualized
for the virtual data loading of elements and plugged it to the react-select
(the most used autocomplete library for react) menu list.

Install
npm install --save react-select-virtualized
Peer Dependencies
Remember to install them (if they are not already in your project).
{
"react",
"react-dom",
"react-virtualized",
"react-select"
}
Note
The select component will be the same from react-select v3
so you will be able to use it with any select you already have.
Try It!!!

Check Storybook for more examples
What we do support and don't from react-select
Components: Select, Async, Creatable
Documentation - this are special to this library and none is required
Toggle
Props | Type | Default | Description |
---|
grouped | boolean | false | specify if options are grouped |
formatGroupHeaderLabel | function({ label, options}) => component | | will render a custom component in the popup grouped header (only for grouped) |
formatOptionLabel (coming from react-select) | function(option, { context }) => component | | will render a custom component in the label |
optionHeight | number | 31 | height of each option |
groupHeaderHeight | number | | header row height in the popover list |
maxHeight (coming from react-select) | number | auto | max height popover list |
defaultValue | option | | will set default value and set the component as an uncontrolled component |
value | option | | will set the value and the component will be a controlled component |
onCreateOption (Only for Creatable) | function(option) => nothing | | will be executed when a new option is created , it is only for controlled components |
Examples
Options Shape
const options = [
{
value: 1,
label: `guiyep`,
},
...
];
const opsGroup = [
{ label: `Group Name Header`, options },
...
]
Basic
import React from 'react';
import Select from 'react-select-virtualized';
const Example1 = () => <Select options={options} />;

With group
import React from 'react';
import Select from 'react-select-virtualized';
const Example1 = () => <Select options={options} grouped />;

Usage Async
import React from 'react';
import { Async } from 'react-select-virtualized';
const loadOptions = (input, callback) => {...};
const Example1 = () => <Async loadOptions={loadOptions}/>
const Example2 = () => <Async defaultOptions={options} loadOptions={loadOptions}/>
const Example3 = () => <Async defaultOptions={opsGroup} loadOptions={loadOptions} grouped/>
Async - No Group

Async - Grouped

Usage with creatable
import React from 'react';
import { Creatable } from 'react-select-virtualized';
const Example1 = () => <Creatable options={options} />;

Usage with creatable and group
NOT YET DONE.
Roadmap
Toggle
-- v 1.0.0 --
-- v 1.1.0 --
-- v 1.2.0 --
-- v 2.0.0 --
-- v 2.1.0 --
-- v 2.2.0 --
-- v 2.3.0 --
-- v 2.4.0 --
License
MIT © guiyep