MantineLookupView#
@palmyralabs/rt-forms-mantine · form/view/MantineLookupView.tsx
Overview#
Read-only foreign-key display — counterpart to MantineServerLookup. When the field value is an object (not just an id), reads the configured label attribute off it — e.g. { id: 42, name: 'Acme Pharma' } renders as "Acme Pharma".
Props — ILookupViewOptions & TextViewAttributeDefinition#
Common field props plus:
| Prop | Type | Purpose |
|---|---|---|
lookupOptions |
{ labelAttribute?, idAttribute?, ... } |
Attribute on the resolved object to render (labelAttribute, default 'name') |
textAlign, variant |
(see overview) | Shared view props |
Ref#
Spread getFieldHandler(fieldManager) + focus() (ref typed any).
Example#
Pair this with a backend handler that expands the foreign key into a nested object so the view can read .name directly:
<MantineLookupView
attribute="manufacturer"
label="Manufacturer"
lookupOptions={{ labelAttribute: 'name' }}
/>If your payload stores only an id, fetch the referenced record first (for example via a PalmyraLookupStore) and place it into the form data under attribute before rendering.