Installed

elm/browser
1.0.2
elm/core
1.0.5
elm/html
1.0.0

Registry

elm/http
2.0.0
elm/random
1.0.0
elm/time
1.0.0
elm/file
1.0.5
elm/json
1.1.3
elm/svg
1.0.1
evancz/elm-playground
1.0.3
elm-explorations/webgl
1.1.3
w0rm/elm-physics
5.1.3
rtfeldman/elm-css
18.0.0
mdgriffith/elm-ui
1.1.8
​x
    [ input [ placeholder "Text to reverse", value model.content, onInput Change ] []
 
1
-- A text input for reversing text. Very useful!
2
--
3
-- Read how it works:
4
--   https://guide.elm-lang.org/architecture/text_fields.html
5
--
6
​
7
import Browser
8
import Html exposing (Html, Attribute, div, input, text)
9
import Html.Attributes exposing (..)
10
import Html.Events exposing (onInput)
11
​
12
​
13
​
14
-- MAIN
15
​
16
​
17
main =
18
  Browser.sandbox { init = init, update = update, view = view }
19
​
20
​
21
​
22
-- MODEL
23
​
24
​
25
type alias Model =
26
  { content : String
27
  }
28
​
29
​
30
init : Model
31
init =
32
  { content = "" }
33
​
34
​
35
​
36
-- UPDATE
37
​
38
​
39
type Msg
40
  = Change String
41
​
42
​
43
update : Msg -> Model -> Model
44
update msg model =
45
  case msg of
46
    Change newContent ->
47
      { model | content = newContent }
48
​
49
​