Demos
Schema for single field
Code Editor
<Field.String schema={{ type: 'string', minLength: 5, }} />
Schema for a whole data set
Code Editor
<Form.Handler data={{ address: 'Prefilled address', }} schema={{ type: 'object', properties: { name: { type: 'string', minLength: 2, }, address: { type: 'string', minLength: 3, }, }, required: ['name', 'address'], }} > <Card spacing="small" bottom="small"> <Form.MainHeading>Company information</Form.MainHeading> <Field.String path="/name" label="Name" /> <Field.String path="/address" label="Address" /> </Card> <Form.SubmitButton /> </Form.Handler>
Schema with if-rule
Code Editor
<Form.Handler data={{}} schema={{ type: 'object', properties: { name: { type: 'string', }, customerType: { type: 'string', enum: ['corporate', 'private'], }, companyName: { type: 'string', }, }, if: { properties: { customerType: { enum: ['corporate'], }, }, required: ['customerType'], }, then: { required: ['name', 'companyName'], }, else: { required: ['name'], }, }} > <Card spacing="small" bottom="small"> <Form.MainHeading>Customer information</Form.MainHeading> <Field.String path="/name" label="Name" /> <Field.String path="/customerType" label="Customer type (corporate or private)" /> <Field.String path="/companyName" label="Company name (required for corporate customers)" /> </Card> <Form.SubmitButton /> </Form.Handler>
Dependant list schema
Becoming a new customer, this form requires at least one normal account to be added, unless the customer opens a BSU account, then normal accounts can still be added, but is optional.