-
-
Save cstuncsik/37a4edbe697c51a01a0f0853ed302d0a to your computer and use it in GitHub Desktop.
Text Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0.0", | |
"summary": "https://guide.elm-lang.org/architecture/user_input/text_fields.html", | |
"repository": "https://github.com/user/project.git", | |
"license": "BSD3", | |
"source-directories": [ | |
"." | |
], | |
"exposed-modules": [], | |
"dependencies": { | |
"elm-lang/core": "5.1.1 <= v < 5.1.1", | |
"elm-lang/html": "2.0.0 <= v < 2.0.0" | |
}, | |
"elm-version": "0.18.0 <= v < 0.19.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script> | |
var app = Elm.Main.fullscreen() | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (..) | |
import Html exposing (Html, Attribute, div, input, text) | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (onInput) | |
main : Program Never Model Msg | |
main = | |
Html.beginnerProgram { model = model, view = view, update = update } | |
type alias Model = | |
{ content : String | |
} | |
model : Model | |
model = | |
{ content = "" } | |
type Msg | |
= Change String | |
update : Msg -> Model -> Model | |
update msg model = | |
case msg of | |
Change newContent -> | |
{ model | content = newContent } | |
view : Model -> Html Msg | |
view model = | |
div [] | |
[ input [ placeholder "Text to reverse", onInput Change ] [] | |
, div [] [ text (String.reverse model.content) ] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment