FieldComponents
Your component for each field type, by type name: { text: TextInput, group: GroupFieldset }. Each one gets the props of its type's role.
ts
type FieldComponents = Record<string, Component>Explanation
See field components.
ValueFieldProps
ValueFieldPropsfieldJsonField: the field from the definitionpathFieldPath: its Formisch path, with real indexeskindValueKind: the kind of its valuerequiredboolean: whether the definition makes it requiredinputunknown: its current inputerrors[string, ...string[]] | null: its error messagesinputPropsFieldElementProps: Formisch's element props, to bind to the input elementsetInput(input: unknown) => void: sets the input, after turning what an element gives into the value of its kind
GroupFieldProps
GroupFieldPropsfieldJsonFieldpathFieldPath
Its default slot, typed as GroupFieldSlots, renders the group's fields.
ArrayFieldProps
ArrayFieldPropsfieldJsonFieldpathFieldPathitemsstring[]: one id per item, to use as its keyerrors[string, ...string[]] | null: the list's own messagesadd() => void: adds an item at the endremove(index: number) => voidmove(from: number, to: number) => void
Its default slot, typed as ArrayFieldSlots, renders the fields of the item at index: <slot :index="index" />.
DisplayFieldProps
DisplayFieldPropsfieldJsonField
Example
ts
import type { FieldComponents } from '@whatsaaaa/form-builder-vue'
import CheckboxInput from './CheckboxInput.vue'
import GroupFieldset from './GroupFieldset.vue'
import FileInput from './FileInput.vue'
import FormHeading from './FormHeading.vue'
import ListRepeater from './ListRepeater.vue'
import SelectInput from './SelectInput.vue'
import TextInput from './TextInput.vue'
export const components: FieldComponents = {
text: TextInput,
email: TextInput,
number: TextInput,
checkbox: CheckboxInput,
select: SelectInput,
radio: SelectInput,
file: FileInput,
group: GroupFieldset,
array: ListRepeater,
heading: FormHeading,
// ...one for every type your definitions use
}