Skip to content

Form Engine — Component API Reference ​

Complete props, emits, slots, and exposed methods for all Form Engine components and field types.


MapoForm ​

The main form renderer. Takes a descriptor array and a model, then renders the appropriate field components.

Descriptor typing guidance:

  • Use FieldDescriptor<T>[] when the form uses only built-in field types. This keeps strict compile-time checks on attrs and catches typos early.
  • Use AnyFieldDescriptor<T>[] only when the form includes custom field types.
  • AnyFieldDescriptor does not prove that a field type is present in the registry. Registry resolution is runtime behavior; unresolved types render MapoUnknownField instead of crashing.

Props ​

PropTypeDefaultDescription
modelValueT— requiredThe form data object (v-model).
fieldsAnyFieldDescriptor<T>[]— requiredArray of field descriptors defining the form layout.
errorsRecord<string, string[]>{}Server-side validation errors keyed by field path.
languagesstring[][]Available language codes for translated fields.
currentLangstring''Active language code. Controlled externally (by MapoDetail).
readonlybooleanfalseMake all fields read-only.
immediatebooleanfalseRun client validators immediately without waiting for the first submit.
registryFieldRegistry—Field component registry. Auto-injected from $mapoFormRegistry if omitted.

Emits ​

EventPayloadDescription
update:modelValueTEmitted whenever any field changes.

Slots ​

SlotDescription
field.{key}Override the rendering of a specific field. Receives { field: FieldDescriptor, model: T | undefined, currentLang: string }.

Exposed Methods ​

MethodSignatureDescription
submit(handler: (payload, isNew) => Promise<void>, isNew?: boolean) => Promise<void>Run all validators; on success call handler with the full model (isNew=true) or the diff patch (isNew=false).
validateClient() => { valid: boolean; errors: Record<string, string> }Run all synchronous client validators. Returns valid and a map of field errors.
resetDirty() => voidReset the dirty-tracking baseline (call after a successful save).
getPatch() => Partial<T>Return only the fields changed since the last resetDirty.
isDirtyRef<boolean>Reactive flag — true when any field has changed since the last baseline.
isLoadingRef<boolean>Reactive flag — true while the submit handler is executing.

MapoFormField ​

Low-level wrapper that resolves a FieldDescriptor to its registered component, handles label, hints, errors, and slot injection.

Props ​

PropTypeDefaultDescription
descriptorAnyFieldDescriptor— requiredThe field configuration object.

Slots ​

SlotDescription
field.{key}.labelOverride the field label. Receives { descriptor, label, model, currentLang }.
field.{key}.beforeContent rendered before the field wrapper. Receives { descriptor, model, currentLang }.
field.{key}.prependContent prepended inside the field control. Receives { descriptor, model, currentLang }.
field.{key}.appendContent appended inside the field control. Receives { descriptor, model, currentLang }.
field.{key}.hintOverride the hint text. Receives { descriptor, model, currentLang }.
field.{key}.afterContent rendered after the field wrapper. Receives { descriptor, model, currentLang }.

MapoFormGroup ​

Collapsible section that groups related fields under a heading.

Props ​

PropTypeDefaultDescription
namestring— requiredGroup identifier.
labelstring—Group heading label.
fieldsFieldDescriptor[]— requiredFields belonging to this group.
initialExpandedboolean—Whether the group starts expanded.

MapoFormFlatSection ​

Flat grid layout for fields that belong to no group. Renders fields in a 12-column responsive grid and provides the same field-expand overlay as MapoFormGroup — without a collapsible heading.

Used internally by MapoForm for fields that have no group or tab set.

Props ​

PropTypeDefaultDescription
fieldsFieldDescriptor[]— requiredFields to render in the grid.

Slots ​

Forwards all field.* slot names to each MapoFormField child (same forwarding contract as MapoFormGroup).


MapoFormTabs ​

Tab-based layout for organizing fields into named sections.

Props ​

PropTypeDefaultDescription
tabsTabEntry[]— requiredTab definitions. Each entry has { label, fields }.

MapoFocusPortal ​

Full-screen overlay for editing a Repeater item in focus mode. Mount once inside your default layout.

Props / Emits / Slots ​

None — controlled internally by MapoRepeater via a shared provide/inject.


MapoUnknownField ​

Fallback field rendered when no matching component is found in the registry.

Props ​

PropTypeDefaultDescription
modelValueunknown— requiredCurrent value.
descriptorFieldDescriptor— requiredField descriptor.
errorsstring[]—Validation error messages.
readonlyboolean—Read-only mode.
disabledboolean—Disabled mode.

Emits ​

EventPayloadDescription
update:modelValueunknownEmitted on value change.

Field Components ​

All field components share the same base interface:

ts
Props: { modelValue, descriptor, errors?, readonly?, disabled? }
Emits: { 'update:modelValue': value }

MapoDateField ​

Date-only picker. Serializes as YYYY-MM-DD.

PropTypeDescription
modelValueunknownISO date string or null.
descriptorDateDescriptorField configuration.

MapoTimeField ​

Time-only picker. Emits HH:MM format.

PropTypeDescription
modelValueunknownTime string or null.
descriptorDateDescriptorField configuration.

MapoDateTimeField ​

Combined date + time picker with optional timezone handling (naive / UTC).

PropTypeDescription
modelValueunknownISO datetime string or null.
descriptorDateDescriptorField configuration. attrs.tz controls timezone mode.

descriptor.attrs ​

KeyTypeDefaultDescription
tz'naive' | 'UTC''naive'Timezone handling mode.

MapoSeoPreview ​

SEO metadata editor with live SERP preview.

PropTypeDescription
modelValueunknown{ title?, description?, permalink? }
descriptorSeoDescriptorField configuration.

MapoFileField ​

File upload field with current-file preview, remove button, and optional image thumbnail. Replaces the plain <input type="file"> used for the 'file' registry type.

PropTypeDescription
modelValueunknownA File object, a URL string, or null.
descriptorFileDescriptorField configuration.

descriptor.attrs ​

KeyTypeDefaultDescription
acceptstring—MIME type filter forwarded to the <input> (e.g. 'image/*').
maxSizenumber—Maximum file size in bytes (UI hint only — not enforced client-side).

When modelValue is a URL string ending in an image extension (.jpg, .png, .webp, etc.) a thumbnail is shown alongside the filename.


MapoWygEditor ​

WYSIWYG rich-text editor powered by TipTap. Output is sanitized HTML.

PropTypeDescription
modelValueunknownHTML string.
descriptorEditorDescriptorField configuration.

The toolbar includes a disabled Insert Image button (placeholder for Phase 6 — Media Manager). It becomes active once MapoMediaManagerDialog is available.


MapoMapField ​

Geographic coordinate picker with a Leaflet map and manual lat/lng inputs.

PropTypeDescription
modelValueunknown{ lat: number, lng: number } | null
descriptorMapDescriptorField configuration.

descriptor.attrs ​

KeyTypeDefaultDescription
defaultLatnumber41.9Initial map latitude when no value is set.
defaultLngnumber12.5Initial map longitude when no value is set.
zoomnumber6Initial map zoom level.

MapoFksField ​

Foreign key selector with remote search. Supports single and multi-select.

PropTypeDescription
modelValueunknownSelected item object, array of items, or ID(s).
descriptorFksDescriptorField configuration.

descriptor.attrs ​

KeyTypeDefaultDescription
endpointstring— requiredAPI endpoint for option search. Relative paths (no leading /) are automatically normalized by prepending /.
itemTextstring'name'Model field to display as label.
itemValuestring'id'Model field to use as value.
multiplebooleanfalseAllow multi-selection.
returnObjectbooleantrueEmit the full object instead of only the ID.

MapoRepeater ​

Dynamic list field with drag-and-drop reordering, bulk selection, duplication, and focus mode.

PropTypeDescription
modelValueunknownArray of item objects.
descriptorRepeaterDescriptorField configuration.

descriptor.attrs ​

KeyTypeDefaultDescription
templatesRecord<string, FieldDescriptor[] | RepeaterTemplate>—Named templates (one per item type). A value is a bare field array or a RepeaterTemplate.
picker'auto' | 'select' | 'modal''auto'How the user chooses a template on add: dropdown, block gallery modal, or auto (modal when there are more than 3 templates).
previewLabel(item, index) => string—Callback to generate an item's collapsed preview label.
defaultExpandedbooleanfalseStart all items expanded.
allowDuplicatebooleantrueShow the Duplicate action on each item.
showPositionFieldbooleanfalseShow a numeric position input in each item's header for explicit reordering.
minItemsnumber—Minimum number of items (validated on submit).
maxItemsnumber—Maximum number of items (Add button hidden when reached).
confirmDeletebooleantrueShow a confirmation dialog before deleting an item.
miniCard(item, idx) => { title, subtitle, thumbnail, statusColor }—Config for the compressed mini-card view.
compressThresholdnumber3Number of items above which the list switches to mini-card view.

RepeaterTemplate ​

Exported from @mapomodule/form/types. Presentation metadata for a template, used by the select and the block picker.

KeyTypeDefaultDescription
fieldsFieldDescriptor[]— requiredField descriptors of the block.
labelstringtemplate keyHuman-readable name.
descriptionstring—Short explanation of what the block is for.
iconstring—Iconify name (e.g. i-lucide-image). Preview fallback and icon in the item header badge.
imagestring—Preview image URL for the picker card. Takes precedence over wireframe and icon.
wireframeboolean—Draw a schematic preview from the template fields (used when there is no image).
categorystring—Group name: the picker shows one filter chip per category.

MapoRepeaterBlockPicker ​

Modal gallery used by MapoRepeater to choose a template when adding an item. It has a search box, category chips and one card per template; the card preview is image, else wireframe, else icon. Internal to the repeater: you configure it through attrs.picker and RepeaterTemplate.

Props ​

PropTypeDefaultDescription
templatesPickerTemplate[]— requiredNormalized templates (key, label, fields, plus the RepeaterTemplate metadata).
disabledboolean—Disable the cards (e.g. maxItems reached).
openbooleanfalsev-model:open — modal visibility.

Emits ​

EventPayloadDescription
selectkey: string, keepOpen: booleanA card was chosen. keepOpen is true when Shift was held, to add several blocks in a row.

MapoRepeaterItem ​

Single item inside a MapoRepeater. Handles both full-form and mini-card views.

Props ​

PropTypeDefaultDescription
itemRecord<string, unknown>— requiredItem data.
fieldsFieldDescriptor[]— requiredItem form fields.
indexnumber— requiredItem index in the parent array.
errorPrefixstring— requiredError key prefix (e.g. 'items.0').
parentErrorsRecord<string, string[]>— requiredErrors from the parent form.
languagesstring[]— requiredLanguage codes.
currentLangstring— requiredActive language.
readonlyboolean— requiredRead-only mode.
registryFieldRegistry— requiredField registry.
previewLabel(item, index) => string—Callback to generate the collapsed preview label.
defaultExpandedboolean— requiredInitial expanded state.
allowDuplicateboolean—Show Duplicate action.
repeaterDescriptorRepeaterDescriptor—Parent repeater descriptor (for mini-card config).
totalItemsnumber—Total number of items in the parent repeater.
selectedboolean—Whether this item is bulk-selected.
selectionModeboolean—Whether bulk selection mode is active.
templateLabelstring—Template name, shown as a badge in the header.
templateIconstring—Iconify name shown in the template badge.

Emits ​

EventPayloadDescription
update:itemRecord<string, unknown>Item data changed.
delete—Delete this item.
duplicate—Duplicate this item.
move-up—Move this item one position up.
move-down—Move this item one position down.
move-toindex: numberMove this item to a specific index.
toggle-select—Toggle bulk-selection of this item.

Slots ​

SlotDescription
actionsCustom action buttons in the item toolbar.

NUI Wrapper Fields ​

Thin wrappers around Nuxt UI primitives that integrate with the form registry system. They inherit all attributes and props from the underlying Nuxt UI component.

ComponentWrapsRegistry keysNotes
NuiInputUInput'text', 'email', 'url', 'number', 'color'number/email/url/color set the native type via registry attrs.
NuiTextareaUTextarea'textarea'
NuiSliderUSlider'slider'
NuiCheckboxUCheckbox'boolean'
NuiSwitchUSwitch'switch'
NuiSelectMenuUSelectMenu'select'Accepts items ({ label, value } or strings) and legacy options ({ text, value }); shapes are normalised internally.

Released under the MIT License.