Basic Form
These previews use Radiant because the docs app is Ecopages + Radiant UI.
This is the smallest useful JSON form: register elements, describe steps as data, and choose an optional view recipe at the form level.
Interactive demo
Configuration
const formConfig: FormConfig = {
id: 'basic-contact',
title: 'Contact Us',
description: 'Get in touch with our team',
steps: [
{
id: 'details',
title: 'Your Information',
elements: [
{
$type: 'input',
id: 'name',
name: 'name',
label: 'Full Name',
inputType: 'text',
rules: [
{
type: 'required',
message: 'Name is required'
}
]
},
{
$type: 'input',
id: 'email',
name: 'email',
label: 'Email Address',
inputType: 'email',
rules: [
{
type: 'required',
message: 'Email is required'
},
{
type: 'email',
message: 'Invalid email format'
}
]
},
{
$type: 'textarea',
id: 'message',
name: 'message',
label: 'Message',
rows: 5
}
]
}
],
view: {
$type: 'card',
shell: {
appearance: {
size: 'default',
surface: 'elevated'
}
}
}
};The renderer validates the configuration against the registrations in the
engine. A form without view is also valid; it renders its elements without
recipe-provided chrome.
The same configuration renders in React: React Forms.
Extend it
- Add validation rules to an element.
- Add responsive placement with the form or element
gridproperty: Placing fields in the grid and the styling recipes. - Add a view recipe when the form needs a shell or wizard navigation.
- Add actions for submission and lifecycle behavior.