This module is useful if you want to add an TextArea Form element to your app.
Add a TextArea.Model to your model.
myInitialModel : MyModel
myInitialModel =
{ myTextArea = TextArea.init -- optionally pipe into State Setters
}Add a TextArea.Msg to your Msg.
type MyMsg
= UpdateMyTextArea TextArea.MsgUse in your update function.
myUpdate : Msg -> Model -> ( Model, Cmd Msg )
myUpdate msg model =
case msg of
UpdateMyTextArea inputMsg ->
{ model | myTextArea = TextArea.update inputMsg mode.myTextArea } ! []Transform an TextArea.Model into an TextArea.View, which allows us to pipe View Setters on it.
myView : Model -> Html Msg
myView model =
div
[]
[ TextArea.view model.myTextArea -- pipe view setters here, for example |> setIsLocked 'your logic here'
]Transforms an TextArea.View into Html TextArea.Msg
myView : Model -> Html Msg
myView model =
div
[]
[ TextArea.view model.myTextArea
|> TextArea.render
|> Html.map UpdateMyTextArea
]ReInitialise your TextArea.Model.
Set the initial value of your TextArea.Model.
Set a ist of string that should be replaced.
Set a placeholder for your input.
Set the max length for your input string.
Set whether your input is in error mode (red border).
Set whether your input is locked (disabled).
Give your input an id. Can be useful for DOM selectors (focus, WebComponents etc.)
Get the initial value of your input.
Get the current value of your input. This is what you'd use to display the data somewhere outside of your input, or to send the data to the backend for example etc.
Whether your input was changed. Useful if you want to disable save buttons unless there were changes etc.
Useful if you need the id of the input in your update function, so set focus etc.
Add a TextArea.Model to your model.