abradley2/form-controls/2.0.2

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/abradley2/form-controls is gone (deleted or private); Software Heritage has no tag 2.0.2 for it; no fork with tag 2.0.2 found (60 same-name repos checked); no cached copy. Use another version.

Details

FormControls.TextInput

A text input widget for Elm

TEA

view : Model -> Props -> Html Msg

view The view function for displaying the text input element

init : String -> ( Model, Cmd Msg )

init Initialization for the text input model. The id passed in must be unique

update : Msg -> Model -> ( Model, Cmd Msg )

update The update function for the text input element

defaultProps : Props

defaultProps Default props for the text input. Generally the label should be set before passing these defaults to the view

type Msg
= NoOp
| OnInput String
| OnFocus
| OnBlur
| OnInputKeyPress Int

Msg

  • OnInput
type alias Model =
{ id : String
, hasFocus : Bool
}

Model Tracks the internal foxus state of the element

type alias Props =
{ id : String
, label : String
, value : String
, errorText : Maybe String
, helperText : Maybe String
, fieldType : FieldType
}

Props

  • id Unique id for the elements
  • label Label for the text input
  • value The value of the text input
  • errorText Set this to a string when there is a validation error to display to the user. Will override helperText
  • helperText Helpful text displayed under the text input