Layout - FormBuilder
Layout.FormBuilderDefine a UI Form from a
Stream within a LayoutBuilder.Remarks
A Form is editable when defined from a writable
Stream, such as produced by a SourceBuilderExample
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
integer: IntegerType,
boolean: BooleanType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.string("String", fields => fields.string)
.integer("Integer", fields => fields.integer)
.boolean("Boolean", fields => fields.boolean)
.float("Float", fields => fields.float)
)
.toTemplate()
Layout
constructor
• new FormBuilder(name
, module
):
FormBuilder
Define a UI Form from a
Stream within a LayoutBuilder.Parameters
Name | Type |
---|---|
name | string |
module | ModulePath |
Returns
FormBuilder
Remarks
A Form is editable when defined from a writable
Stream, such as produced by a SourceBuilderExample
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
integer: IntegerType,
boolean: BooleanType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.string("String", fields => fields.string)
.integer("Integer", fields => fields.integer)
.boolean("Boolean", fields => fields.boolean)
.float("Float", fields => fields.float)
)
.toTemplate()
fromStream
▸ fromStream(stream
):
FormFinalizer
Define the
Stream to build a FormBuilder within a LayoutBuilder.Type parameters
Name | Type |
---|---|
T | extends StructType |
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | the StructType Stream to build the table from |
Returns
FormFinalizer
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
integer: IntegerType,
boolean: BooleanType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.inputs()
)
.toTemplate()