Form
note
To use the Form component with an API, you will need to define an appName (string) at the top level of your template.
A form is used to power interactivity in open platform apps. All forms have a name prop in their onSubmit field. When a form is submitted,
we store any returned data under the name of the form. So if a form's name is generatedRegex, then the result of the API call to api/codegen can be
accessed as {{ generatedRegex }}.
- Usage
- Props
Required properties
items: Array<component>,
submitButton: {
text: "Fixed text",
loadingText: "some text"
},
onSubmit: {
api: "path/to/api",
request: "POST" | "GET",
name: "nameOfRequest" // used to reference returned data from API
}
Optional properties
defaultValues: { // these will be included with the POST/GET as data/params, and used to autofill input elements
key: "value",
otherKey: "otherValue"
}