Form component

Installing and using custom form components

Kissflow lets you build a fully custom UI for dataform, board, and process forms using the useForm React hook. It drives Kissflow's validation, permissions, dynamic field state, and persistence for you — including child tables — from a single dynamic configuration.

1. Creating a new custom form component

If you're starting a project from scratch, you can create a Kissflow custom form component package using npm

npx @kissflow/create-component@latest

You will be prompted to provide a name for your component and choose form.

Note

You can also scaffold non-interactively (for example, in CI) with npx @kissflow/create-component@latest --target form --name my-form --yes.

Note

This scaffolds a Vite/React app pre-wired with a useForm hook, a reference form implementation (src/form/), and field components for every Kissflow field type.

Once installed, run the following commands:

cd componentname
npm install
npm run dev

Once development is done, you can use the npm run zip command to build and compress the project into a zip file. You can then import this zip file directly into Kissflow as a custom Form component.

Note

Prerequisite: Node.js version 18.14.1 and above.

Using the useForm hook

import { useForm } from "./hooks/useForm";

const { formData, config, updateField, isSaving, errors } = useForm({
    flowType: "dataform",
    flowId: "EmpMaster",
    instanceId: "emp_123" // omit to create a new record
});

Parameters

useForm takes a single options object.

ParameterTypeRequiredDescription
flowTypeStringYes"dataform", "board", or "process".
flowIdStringYesId of the dataform, board, or process.
instanceIdStringNoRecord instance Id to load. Omit to create a new record.
viewIdStringNoDataform/board only. The view whose layout and permissions to apply.
activityInstanceIdStringNoProcess only. The activity (task) instance the form is being filled for.

Returns

useForm returns an object with the following properties:

PropertyTypeDescription
formDataObjectCurrent values keyed by field Id. Child-table rows live at formData[tableId].
configObjectForm configuration — { formPermission, sections }.
errorsObjectValidation errors, nested by section/table/row.
loadingBooleanTrue during initial load and while runAction() is in flight.
errorString | nullGeneral error message if an operation failed.
isSavingBooleanTrue while an updateField/updateFields autosave request is in flight.
isNewRecordBooleanTrue when no instanceId was provided.
updateField(fieldId, value)FunctionValidates, autosaves, and refreshes field state. Returns Promise<boolean>.
updateFields(updates)FunctionBatch autosave of { fieldId: value }. Returns Promise<boolean>.
getField(fieldId)FunctionReturns Promise<object> with the full details of one field.
getFieldOptions(fieldId, tableId?, rowId?)FunctionReturns Promise<object[]> of dropdown/select options. Pass tableId/rowId for a table cell.
getFormData()FunctionReturns Promise<object> with the latest data straight from the form store.
parseAttachment(fieldId, file)FunctionProcess only. Runs AI Smart Attachment parsing; returns Promise<{ appliedFields, suggestedBy }>.
runAction(action, extra?)FunctionSingle dispatcher for every lifecycle action (submit/discard/reject/etc), resolved from flowType. Returns Promise<boolean>.
getTable(tableId)FunctionReturns child-table operations: addRow, addRows, updateRow, deleteRow, deleteRows, getRowField, getSelectedRows.
processStatusStringProcess only. The item's current status (Draft, InProgress, Completed, …).
isStartStepBooleanProcess only. True when the current activity is the process's start step.
formActionsObject[]Process only. Ordered workflow-action descriptors for the current step. Empty array for dataform/board.
getReassignees(query?)FunctionProcess only. Returns Promise<object[]> of candidate assignees for the Reassign action.

Note

This page covers the useForm hook's inputs and outputs. For the full guide — the config object shape, saving vs submitting, child tables, validation error handling, actions, and troubleshooting — see the README.md generated inside your scaffolded project, or the reference implementation at src/form/index.jsx.

On this page