Record type defining the form fields and their configurations
Optional
fields?: TConfiguration object defining all form fields
Optional
title?: stringMain title displayed at the top of the form
Optional
subtitle?: stringSubtitle or description text below the title
Optional
submitLabel?: stringText for the submit button (defaults to 'OK')
using form = app.scene(generic(Form), {
defaultProps: {
title: 'Participant Information',
subtitle: 'Please fill out the following information',
},
});
const formData = await form.show({
fields: {
name: {
type: 'TextField',
label: 'Full Name',
validate: (value) =>
value.length >= 2 || 'Name must be at least 2 characters',
},
age: {
type: 'NumberField',
label: 'Age',
min: 18,
max: 100,
},
consent: {
type: 'Checkbox',
label: 'I consent to participate in this study',
},
},
});
console.log(formData.name); // string
console.log(formData.age); // number
console.log(formData.consent); // boolean
Dynamic form component that creates a complete form with multiple fields