Micro-sized & micro-optimized select component for React.js
See the accompanying Interactive Storybook UI Site for live demos and detailed docs.
Key features:
- Extremely lightweight: ~6 kB (gzipped)!
- Advanced features like async mode, portal support, animations, and option virtualization
- Fully-featured & customizable: API comparable to
react-select - Engineered for ultimate performance: effortlessly scroll, filter, and key through datasets numbering in the tens of thousands using
react-window+ performance-first code. Demo of handling 50,000 options here! - Extensible styling API with
styled-components - Accessible
Peer dependencies:
styled-componentsfor dynamic styling/theming via CSS-in-JSreact-windowfor integrated menu option data virtualization
Overview
Essentially, this is a focused subset of react-select's API that is engineered for ultimate performance and minimal bundle size. It is built entirely with the React Hooks API (no legacy class components). The primary design principal revolves around weighing the cost/benefits of adding a feature against the impact to performance and/or number of lines of code its addition would have.
Any expected features not in the current API is likely due to the reason that such features would have added significant overhead to the package. In addition, if we expose the right public methods and/or callback properties, this feature should be trivial to add to wrapping components - proper decoupling and abstraction of code is key to keeping such channels open for similar customizations that can be kept out of this package. Please, feel free to offer enhancement ideas with/without technical solutions.
Installation
$ npm i react-window styled-components react-functional-select
$ yarn add react-window styled-components react-functional-select
Note that you need to be on a react version that supports hooks (>= 16.8.6)