Extensions

Press shift + S to search API reference.

Function

expandRecordPickerAsync

View source

Expands a list of records in the Airtable UI, and prompts the user to pick one. The selected record is returned to the extension, and the modal is automatically closed.

If the user dismisses the modal, or another one is opened before this one has been closed, it will return null.

Returns a promise that resolves to the record chosen by the user, or null.

import {expandRecordPickerAsync} from '@airtable/blocks/ui';
async function pickRecordsAsync() {
const recordA = await expandRecordPickerAsync([record1, record2, record3]);
if (recordA !== null) {
alert(recordA.name);
} else {
alert('no record picked');
}
const recordB = await expandRecordPickerAsync([record1, record2], {
fields: [field1, field2],
});
}

Function signature

function (records: Array<Record>, opts?: ExpandRecordPickerOpts) => Promise<Record | null>
records

the records the user can pick from. Duplicate records will be removed.

opts

An optional options object.