ReferenceInput
Chooses a related record by its foreign key.
Installation
pnpm dlx shadcn@latest add @chelone/reference-inputChooses a related record by its foreign key.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactElement<unknown, string | JSXElementConstructor<any>> | — | The child input rendered against the reference choices context. Defaults to `<AutocompleteInput>`. |
| debounceMs | number | — | Debounce delay (ms) for filter-driven choices refetches. |
| filter | FilterPayload | — | Permanent filter merged OVER the dynamic filter for every choices fetch. |
| lookupKey | string | — | The field on the referenced record the value matches. `"id"` (default) resolves the selected record via `getMany`; any other key resolves it via `getList({ filter: { [lookupKey]: value } })`. |
| page | number | — | Choices page (1-based). |
| perPage | number | — | Choices per page. |
| reference | string | — | The referenced resource choices are fetched from (e.g. `"companies"`). |
| sort | SortPayload | — | Sort applied to the choices query. |
| source | string | — | The FK field on the current record (e.g. `"company_id"`). |
| validate | undefined | — | `<ReferenceInput>` does not accept a validate prop — set `validate` on the child input instead (the child owns the form binding). |