Skip to content

Integration recipes

Store an ID in the parent form. Convert the returned ID/text pair in onChange and provide a complete row through hydrationRows when it is not in the current dataset.

<LookupSelect
dataSource={loadParts}
columns={columns}
mapper={mapper}
valueFormat="ids"
value={partId}
hydrationRows={selectedPart ? [selectedPart] : []}
onChange={value => setPartId(value?.id ?? null)}
/>

The easiest integration with Ant Design, Material UI, or another design system is to use the default picker inside your form and adapt theme tokens. A deeper integration can replace the grid or dialog using the render contracts in Custom renderers.

Do not pass third-party selection callbacks directly to onRowSelect: most table libraries emit arrays of keys, whereas LookupSelect expects one row to toggle. Translate the event explicitly, honor eligibility, and preserve selection across pages.

Use Ant Design’s Modal for the dialog shell and keep the library’s search, grid and footer. Ant Design 5 and 6 expose open, onCancel and footer={null}. This integration sketch was checked against the API reference and is untested in CI.

import { Modal } from 'antd';
<LookupSelect
data={parts}
columns={columns}
mapper={mapper}
renderModal={({ isOpen, onClose, title, header, children }) => (
<Modal open={isOpen} onCancel={onClose} title={header ? undefined : title}
footer={null} width={720}>
{header}
{children}
</Modal>
)}
/>

Use Dialog, DialogTitle and DialogContent from Material UI. The supplied children contain the picker controls. This integration sketch was checked against the current Dialog API and is untested in CI.

import { Dialog, DialogTitle, DialogContent } from '@mui/material';
<LookupSelect
data={parts}
columns={columns}
mapper={mapper}
renderModal={({ isOpen, onClose, title, header, children }) => (
<Dialog open={isOpen} onClose={onClose} aria-label={title} fullWidth maxWidth="md">
{header ?? <DialogTitle>{title}</DialogTitle>}
<DialogContent>{children}</DialogContent>
</Dialog>
)}
/>

See the Ant Design Modal API and the Material UI Dialog API for library-specific props.

These recipes target the dialog APIs, not third-party grid selection models. They are integration snippets rather than bundled dependencies; verify the exact installed UI-library version and keyboard behavior in your application. The live examples include a fully working native-dialog integration with no additional UI dependency.

  • A controlled selection never changes: update the parent value in onChange.
  • An ID-only initial value cannot be confirmed: supply hydrationRows or use a valid ID/text input for ID/text output.
  • The remote list reloads repeatedly: stabilize the dataSource callback.
  • The modal looks unstyled: import the package CSS, and style the portal via classNames.modal or theme tokens.
  • A virtual row clips its contents: set an appropriate fixed virtualRowHeight.