Skip to content

Instantly share code, notes, and snippets.

@evancz
Created February 27, 2014 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evancz/9242401 to your computer and use it in GitHub Desktop.
Save evancz/9242401 to your computer and use it in GitHub Desktop.
import Char (isDigit)
import String (all)
import Graphics.Input (Input, input, FieldContent, noContent, field)
main : Signal Element
main = scene <~ content.signal
content : Input FieldContent
content = input noContent
scene : FieldContent -> Element
scene fieldContent =
field content.handle id "Type words here" fieldContent
@jjw
Copy link

jjw commented Feb 27, 2014

This example shows a text field that just shows what you type. The content of a text field must be set programmatically to keep the field function pure. This means you pipe the content of the field through to the view.

From https://groups.google.com/d/msg/elm-discuss/du9x7E9AkDE/wKjLD1xpb9EJ

[Part of an ongoing project to index useful gists for newcomers to Elm. Believed correct when posted].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment