
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
react-select-virtualized
Advanced tools
Select virtualized component using: react-select v3 + react-virtualized + react hooks
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.
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.
For using the react version grater than 16.8, please use react-select
v 3.0.8 and the latest version of this library. If you are using react 16.8 please use the latest version but with react-select
v 3.0.4.
npm install --save react-select-virtualized
remember to install them also if they are not already in your project.
{
"react": "^16.8.x || 16.9.x || 16.10.x || 16.11.x",
"react-dom": "^16.8.x || 16.9.x || 16.10.x || || 16.11.x",
"react-virtualized": "^9.21.1",
"react-select": "^3.0.x"
}
https://codesandbox.io/s/vigilant-mclean-wpbk7
Do you want to see it working? -> https://serene-hawking-021d7a.netlify.com/
fast-react-select
.
-- 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 --
When you use the defaultValue
you will be using the component as uncontrolled and the state will be managed for you internally. There are some prop that cannot be mixed and the component will let you know when that is the case. Same happens when you use value
, but will render the component as a controlled component where you will be in charge of the component internal state.
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 |
We support all the UI related props for the input. Extension also.
List: (...To be completed)
We do not support any related prop to the popup list. We extend it. *Sorry no extension of any component inside the list.*
List Props Supported: (...To be completed)
check storybook for more examples, it can be used controlled/uncontrolled.
const options = [
{
value: 1,
label: `guiyep`,
},
...
];
import React, { Component } from 'react';
import Select from 'react-select-virtualized';
const Example extends Component {
render() {
return <Select options={options}/>;
}
}
const Example2 = () => <Select options={options}/>
const Example3 = () => <Select options={options} {..ANY_REACT_SELECT_V2_PROP}/>
check storybook for more examples, it can be used controlled/uncontrolled.
const options = [
{
value: 1,
label: `guiyep`,
},
...
];
const opsGroup = [
{ label: `Group Name Header`, options },
...
]
import React, { Component } from 'react';
import Select from 'react-select-virtualized';
const Example extends Component {
render() {
return <Select options={options} grouped/>;
}
}
const Example2 = () => <Select options={options} grouped/>
const Example3 = () => <Select options={options} {..ANY_REACT_SELECT_V2_PROP} grouped/>
check storybook for more examples, it can be used controlled/uncontrolled.
CLARIFICATION: filtering happens in the server.
import React, { Component } from 'react';
import { Async } from 'react-select-virtualized';
const loadOptions = (input, callback) => {...};
const Example extends Component {
render() {
return <Async defaultOptions={options} loadOptions={loadOptions}/>;
}
}
const Example2 = () => <Async loadOptions={loadOptions}/>
const Example3 = () => <Async defaultOptions={options} {..ANY_REACT_ASYNC_SELECT_V2_PROP} loadOptions={loadOptions}/>
const Example4 = () => <Async defaultOptions={opsGroup} {..ANY_REACT_ASYNC_SELECT_V2_PROP} loadOptions={loadOptions} grouped/>
check storybook for more examples, it can be used controlled/uncontrolled.
UNCONTROLLED:
import React, { Component } from 'react';
import { Creatable } from 'react-select-virtualized';
const Example1 = () => <Creatable options={options} />;
CONTROLLED:
import React, { Component } from 'react';
import { Creatable } from 'react-select-virtualized';
const onCreateOption = (newItem) => {
store.set({ options: store.state.options.concat([newItem]) });
store.set({ selected: newItem });
};
const onChange = (item) => {
store.set({ selected: item });
action(`onChange`)(item);
};
const Example1 = () => (
<Creatable
options={store.state.options}
value={store.state.selected}
onCreateOption={onCreateOption}
onChange={onChange}
/>
);
NOT YET DONE.
MIT © guiyep
FAQs
Select virtualized component using: react-select v4 + react-virtualized + react hooks
The npm package react-select-virtualized receives a total of 8,705 weekly downloads. As such, react-select-virtualized popularity was classified as popular.
We found that react-select-virtualized demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.