---
description: >-
  Quick reference to the essential API methods, parameters, return types, and
  descriptions.
---

# Cheatsheet



## Summary

↳ [#initialization-and-form-retrieval-methods](#initialization-and-form-retrieval-methods "mention")

↳ [#form-instance-methods](#form-instance-methods "mention")

↳ [#hook-methods](#hook-methods "mention")



***

## Initialization and Form Retrieval Methods



<table><thead><tr><th width="250">Method</th><th>Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>new Superform(formName)</code></td><td><code>formName: string</code></td><td>Form Instance</td><td>Initializes a Superform instance for the specified form container.</td></tr><tr><td><code>getForm(formName)</code></td><td><code>formName: string</code></td><td>Form Instance or <code>undefined</code></td><td>Retrieves a Superform instance by name if it exists.</td></tr><tr><td><code>allForms()</code></td><td>None</td><td><code>Array</code></td><td>Returns an array containing all initialized Superform instances.</td></tr></tbody></table>



***

## Form Instance Methods



<table><thead><tr><th width="250">Method</th><th>Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>getFormData()</code></td><td>None</td><td><code>Object</code></td><td>Retrieves form values as an object.</td></tr><tr><td><code>beforeStepChange(fn)</code></td><td><code>fn: function</code></td><td>None</td><td>Registers a listener executed before a step change.</td></tr><tr><td><code>onStepChange(fn)</code></td><td><code>fn: function</code></td><td>None</td><td>Registers a listener executed on a step change.</td></tr><tr><td><code>onFormSubmit(fn)</code></td><td><code>fn: function</code></td><td>None</td><td>Registers a listener executed when the form is submitted.</td></tr></tbody></table>



#### Params Object for Step and Form Submit Methods

| Property    | Type     | Description                             |
| ----------- | -------- | --------------------------------------- |
| `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



<table><thead><tr><th width="241">Method</th><th>Parameters</th><th>Returns</th><th>Description</th></tr></thead><tbody><tr><td><code>registerNavigationHook(hookName, fn)</code></td><td><code>hookName: string</code>, <code>fn: function</code></td><td><a href="#return-types-for-registernavigationhook">Various</a></td><td>Registers a custom navigation hook for dynamic navigation logic.</td></tr><tr><td><code>registerInputValidationHook(hookName, fn)</code></td><td><code>hookName: string</code>, <code>fn: function</code></td><td><code>Boolean</code></td><td>Registers a custom validation hook for form inputs.</td></tr></tbody></table>



#### Return Types for `registerNavigationHook`:

| Return Type                                                                 | Description                                               |
| --------------------------------------------------------------------------- | --------------------------------------------------------- |
| `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.                              |

