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
modelValueTrequiredThe 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.
registryFieldRegistryField 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
descriptorAnyFieldDescriptorrequiredThe 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
namestringrequiredGroup identifier.
labelstringGroup heading label.
fieldsFieldDescriptor[]requiredFields belonging to this group.
initialExpandedbooleanWhether 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
modelValueunknownrequiredCurrent value.
descriptorFieldDescriptorrequiredField descriptor.
errorsstring[]Validation error messages.
readonlybooleanRead-only mode.
disabledbooleanDisabled 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
acceptstringMIME type filter forwarded to the <input> (e.g. 'image/*').
maxSizenumberMaximum 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
endpointstringrequiredAPI 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[]>Named field templates (one per item type).
previewLabel(item, index) => stringCallback 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.
minItemsnumberMinimum number of items (validated on submit).
maxItemsnumberMaximum 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.

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.
indexnumberrequiredItem index in the parent array.
errorPrefixstringrequiredError key prefix (e.g. 'items.0').
parentErrorsRecord<string, string[]>requiredErrors from the parent form.
languagesstring[]requiredLanguage codes.
currentLangstringrequiredActive language.
readonlybooleanrequiredRead-only mode.
registryFieldRegistryrequiredField registry.
previewLabel(item, index) => stringCallback to generate the collapsed preview label.
defaultExpandedbooleanrequiredInitial expanded state.
allowDuplicatebooleanShow Duplicate action.
repeaterDescriptorRepeaterDescriptorParent repeater descriptor (for mini-card config).
totalItemsnumberTotal number of items in the parent repeater.
selectedbooleanWhether this item is bulk-selected.
selectionModebooleanWhether bulk selection mode is active.

Emits

EventPayloadDescription
update:itemRecord<string, unknown>Item data changed.
deleteDelete this item.
duplicateDuplicate this item.
move-upMove this item one position up.
move-downMove this item one position down.
move-toindex: numberMove this item to a specific index.
toggle-selectToggle 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.