UI.TextField

UI Component for entering text.

The component handles the normal text input functionality, like backspace, delete, and moving the cursor with arrow keys.

The important functions you'll need are:

  • init: Initialize the field.
  • update: Update the field when you receive input that you want to attribute to it.
  • toString: Get the string value of the field.
  • view: Render the field as part of your application's view.

Look for the latest "form" example in the repo's example folder for a full working example.

type TextField
init : String -> TextField

Initialize a TextField component.

The passed string will be the starting value.

update : Input -> TextField -> TextField

Update a TextField component with the given Input.

You would normally call this in your update function when you receive an input event that you want to attribute to the text field.

view : TextField -> Element

Render a TextField in your view.

toString : TextField -> String

Get the current value of a TextField as a String.