Cheatsheet
Quick reference to the essential API methods, parameters, return types, and descriptions.
Summary
↳ Initialization and Form Retrieval Methods
Initialization and Form Retrieval Methods
new Superform(formName)
formName: string
Form Instance
Initializes a Superform instance for the specified form container.
getForm(formName)
formName: string
Form Instance or undefined
Retrieves a Superform instance by name if it exists.
allForms()
None
Array
Returns an array containing all initialized Superform instances.
Form Instance Methods
getFormData()
None
Object
Retrieves form values as an object.
beforeStepChange(fn)
fn: function
None
Registers a listener executed before a step change.
onStepChange(fn)
fn: function
None
Registers a listener executed on a step change.
onFormSubmit(fn)
fn: function
None
Registers a listener executed when the form is submitted.
Params Object for Step and Form Submit Methods
data
Object
The current form data
stepCount
Number
The current step index
progress
Number
The current progress percentage (0-100)
scores
Object
Contains score data
Hook Methods
registerNavigationHook(hookName, fn)
hookName: string
, fn: function
Registers a custom navigation hook for dynamic navigation logic.
registerInputValidationHook(hookName, fn)
hookName: string
, fn: function
Boolean
Registers a custom validation hook for form inputs.
Return Types for registerNavigationHook
:
registerNavigationHook
:string
or Promise<string>
Step Teleport by step name indicating the next step name.
"next"
, "prev"
, "previous"
, "back"
or Promise<Linear Instruction>
Linear navigation instruction.
Signed number as string
or Promise<Step teleport string>
Step Teleport by signed number navigation instruction.
hook(HOOK_NAME)
or Promise<"hook(HOOK_NAME)">
Hook navigation instruction.
Last updated