Authors:
Cameron Johns, Cille Schliebitz, Anita Gu
Changed on:
3 Feb 2025
This lesson introduces the concept of custom form fields within the UX Framework. While standard form fields are automatically generated based on data types, developers can create custom field components to handle more complex data structures or enhance the user experience for specific scenarios, such as workflow user actions, GraphQL mutations, and list filters. In our client scenario, we'll focus on building a custom form field to capture stock reservation details, which requires a JSON object containing
`locationRef`
`quantity`
Form fields are the data capture elements in a Web App and are presented on forms to capture user input.
The UX Framework automatically generates forms based on the expected output of the form.
e.g., A form capturing data for a GraphQL mutation or a Workflow Framework User Action.
Developers can extend several scenarios:
Each field in the form is determined by its type, such as a text box for a string field or a date picker for a date-typed field.
The UX Framework provides a number of standard field types, but you can create your own custom field types to handle more complex types using the Component SDK
For example, many user actions require the event attribute to contain a JSON structure. This structure is essentially a composite of other types, such as strings, numbers, and dates, but in a single object.
In our client scenario, the store assistant needs to capture a stock reservation for another store.
To do this, the user action expects an object containing a
`locationRef`
`quantity`
`{`
` "locationRef": "F_NSYD",`
` "quantity": 1`
`}`
A Workflow may be configured to name the type, such as "StockReservationDetails", and declare this in the user action attribute type definition.
The UX Framework will look for field components registered as "StockReservationDetails" and render them to the form. However, this field component does not yet exist.
So, let's move on to the next lesson, which is to build a custom form field for this special complex type.
Copyright © 2025 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.