scrive / elm-form / Form.Field

Read and write field values.

Constructors


type alias Field =
Form.Tree.Tree FieldValue

A field is a tree node.


type FieldValue
    = String String
    | Bool Basics.Bool
    | EmptyField

Form field. Can either be a group of named fields, or a final field.

value : FieldValue -> Field

Build a field from its value.

string : String -> Field

Build a string field, for text inputs, selects, etc.

bool : Basics.Bool -> Field

Build a boolean field, for checkboxes.

group : List ( String, Field ) -> Field

Gather named fields as a group field.

list : List Field -> Field

Gather fields as a list field.

Value readers

asString : Field -> Maybe String

Get field value as string.

asBool : Field -> Maybe Basics.Bool

Get field value as boolean.