Sub-field declaration inside a :nested form field — used for
embedded resources and constrained {:array, :map} attributes.
Lets you customize each sub-field's type, required-ness, default,
position, options, and UI without re-declaring the entire embedded
shape. Sub-fields not explicitly declared are auto-detected when the
parent field has auto_fields true.
Example
field :items, :nested do
nested_field :name, :text do
required true
ui do
label "Item name"
placeholder "e.g. Widget"
end
end
nested_field :count, :number do
position :last
ui do
label "Quantity"
end
end
endSee MishkaGervaz.Form.Entities.Field for the parent field,
MishkaGervaz.Form.Dsl.Fields for the surrounding DSL, and
MishkaGervaz.Form.Entities.NestedField.Ui for the ui sub-entity.
Summary
Types
@type t() :: %MishkaGervaz.Form.Entities.NestedField{ __identifier__: term(), __spark_metadata__: map() | nil, default: any(), name: atom(), options: list() | nil, position: position() | nil, readonly: boolean(), required: boolean() | nil, type: atom() | nil, ui: MishkaGervaz.Form.Entities.NestedField.Ui.t() | nil, visible: boolean() }