Skip to main content

Layout - FormBuilder

Layout.FormBuilder

Define 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 SourceBuilder

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)
.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

NameType
namestring
moduleModulePath

Returns

FormBuilder

Remarks

A Form is editable when defined from a writable

Stream, such as produced by a SourceBuilder

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)
.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

NameType
Textends StructType

Parameters

NameTypeDescription
streamStreamthe 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()