# Custom Fields Module

<WebSDK2 />

The Custom Fields module renders a form generated from a dashboard-defined schema (text, number, boolean, date, double fields) and submits the user's responses. Useful for collecting tenant-specific data that doesn't fit the standard verification primitives.

> Follows the [form-based pattern](doc:web-sdk-2-module-patterns#1-form-based-modules). See the patterns page for the shared lifecycle.

## Availability

This module is headless-only — there is no public `<incode-custom-fields>` web component. Drive it with `createCustomFieldsManager` from `@incodetech/core/custom-fields` and render your own form.

## Configuration

```typescript
type CustomField = {
  name: string;   // Internal field name
  alias: string;  // User-facing label
  type: 'INTEGER' | 'DOUBLE' | 'BOOLEAN' | 'STRING' | 'DATE';
};

type CustomFieldsConfig = {
  title: string;
  customFields: CustomField[];
};
```

| Option         | Type            | Required | Description                                                                                        |
| -------------- | --------------- | -------- | -------------------------------------------------------------------------------------------------- |
| `title`        | `string`        | ✅        | Form title shown above the fields.                                                                 |
| `customFields` | `CustomField[]` | ✅        | Field schema. Each entry's `name` is the data key, `alias` is the label, `type` drives input type. |

The schema is defined in the Incode Dashboard and surfaced through the module's config.

## State machine

`CustomFieldsState` is a discriminated union over `status`:

| Status       | Description                          |
| ------------ | ------------------------------------ |
| `idle`       | Initial state.                       |
| `inputting`  | Form rendered; user fills fields.    |
| `submitting` | Sending field values to the backend. |
| `success`    | Submission accepted.                 |
| `finished`   | Terminal.                            |

## See also

* [Module Patterns → form-based](doc:web-sdk-2-module-patterns#1-form-based-modules)
* [Individual Modules](doc:web-sdk-2-individual-modules)
