React record picker vs dropdown
A React record picker is a selection control for choosing structured records rather than just strings. A modal lookup select opens a searchable table when the user needs multiple columns or a deliberate confirmation step. It returns a value to the surrounding form, rather than acting as a full data-management screen.
Which control should you use?
Section titled “Which control should you use?”| Control | Best fit | Trade-off |
|---|---|---|
| Native select | A small, stable list of labels | No rich table or remote query contract |
| Autocomplete / combobox | Fast text search and suggestions | Less room to compare several fields |
| Modal lookup select | Selecting one or many records by SKU, name, email or other fields | Extra interaction to open and apply |
| Standalone data grid | Editing, browsing or operating on records directly | Requires selection and form integration logic |
react-lookup-select is for the third case. It is not a general-purpose spreadsheet, editable data grid or full form library. Use your existing UI library for those tasks.
Example: purchase order line items
Section titled “Example: purchase order line items”A parts list may contain several similar names. The user needs a SKU, warehouse and stock count before adding a part to an order. The grid shows those fields, while the parent form only needs a set of stable identifiers.
Use columns for the decision context, mapper.getId for identity, and mapper.getText for the trigger label. For multiple selection, return an array and keep draft edits separate until the user applies them.
See Quick start for a complete typed example and remote selection when the inventory does not fit in a local array.
Can I search a remote database?
Section titled “Can I search a remote database?”Yes. Supply a DataSourceFn that maps page, pageSize, search and sort state to your API and returns rows and the matching total. The component does not connect to a database directly. The server remains responsible for authentication, authorization and filtering.
Does the component work without a UI library?
Section titled “Does the component work without a UI library?”Yes. The default trigger, modal and grid use the package stylesheet. React and React DOM are peer dependencies. Replace the UI surfaces with render props or integrate a dialog from Ant Design or Material UI if needed. See custom renderers and integration recipes.
How do I handle large datasets?
Section titled “How do I handle large datasets?”Use server-side pagination to reduce network and memory costs. Fixed-row virtualization reduces mounted DOM rows; it does not remove the cost of filtering, sorting or transferring all records. Measure real performance in your application.