Model class containing information about the state of the user's current interactions in Airtable - specifically, their active table, active view, selected records and selected fields. Also allows you to set the active table and active view.
Selected records and fields are not loaded by default and the cursor must be loaded with useLoadable to access them.
import {useCursor, useWatchable} from '@airtable/blocks/ui';function ActiveTableAndView() {const cursor = useCursor();return (<div>Active table: {cursor.activeTableId}<br />Active view: {cursor.activeViewId}</div>);}
import {useCursor, useLoadable, useWatchable} from '@airtable/blocks/ui';function SelectedRecordAndFieldIds() {const cursor = useCursor();// load selected records and fieldsuseLoadable(cursor);// re-render whenever the list of selected records or fields changesuseWatchable(cursor, ['selectedRecordIds', 'selectedFieldIds']);return (<div>Selected records: {cursor.selectedRecordIds.join(', ')}<br />Selected fields: {cursor.selectedFieldIds.join(', ')}</div>);}