UINode objects with typed bindings, event handlers, and scripting support. This gives you fine-grained control over how data flows into components and how user interactions are processed.
This guide walks you through building a simple V2 form from scratch. By the end, you will have a working form with a card panel, a label bound to live data, and an event handler that responds to user actions.
If you are migrating from V1 card-based forms, see the Migration Guide for a side-by-side comparison.
Prerequisites
- A Kodexa project with at least one data definition (taxonomy)
- A document store with sample data
- Familiarity with the Data Forms overview
Step 1: Create a V2 Data Form
A V2 data form is identified by settingversion: "2" at the top level. The form body is defined in the nodes array, which contains UINode objects instead of flat card entries.
When
version is set to "2" or the nodes array is present and non-empty, the platform automatically uses the V2 schema renderer. Existing V1 forms with cards arrays continue to work unchanged.Step 2: Add a Card Panel with a Label
Every visible element in a V2 form is aUINode with a component field that references a registered component. The V2 renderer re-uses all existing V1 card components — you reference them by their camelCase type name.
Add a card panel containing a label:
component field uses the format namespace:type. All built-in card components live in the card namespace. You can also use just the type name (e.g., "cardPanel") and the registry will resolve it via its alias table.
Step 3: Add a Data Binding
Static labels are useful, but the real power of V2 forms comes from bindings — JavaScript expressions that are evaluated against the current data context. Replace the static label with a binding:bindings object maps prop names to JavaScript expressions. Each expression receives a ctx object containing the current data context, which includes dataObjects, tagMetadataMap, and any loop variables from parent for iterators.
See the Data Binding guide for the full context shape and expression syntax.
Step 4: Add an Event Handler
V2 forms support a rich event system. You can attach handlers to any component event using theevents object. Each handler specifies a type (such as script, emit, or scriptRef) and a target.
Add a click handler that logs a message:
Full Example
Here is the complete V2 form combining all the steps above:Key sections explained
| Section | Purpose |
|---|---|
version | Must be "2" to enable the V2 schema renderer |
nodes | Array of UINode objects forming the component tree |
scripts | Named script registry for reusable functions (referenced via scriptRef events or computed bindings) |
bridge | Configuration for the kodexa.* bridge API, including permissions and execution limits |
