TermUI.Widget.TextInput (TermUI v0.2.0)

View Source

A single-line text input widget.

TextInput allows users to type text, navigate with arrow keys, and delete with backspace/delete.

Usage

TextInput.render(%{
  placeholder: "Enter name...",
  on_change: fn value -> IO.puts("Value: #{value}") end,
  on_submit: fn value -> IO.puts("Submitted: #{value}") end
}, state, area)

Props

  • :value - Initial value (default: "")
  • :placeholder - Placeholder text when empty
  • :on_change - Callback when value changes
  • :on_submit - Callback when Enter pressed
  • :max_length - Maximum input length
  • :style - Input style
  • :cursor_style - Cursor character style

Summary

Functions

Handles events for the text input.

Handles messages to the text input.

Initializes the text input state.

Renders the text input.

Functions

handle_event(arg1, state)

Handles events for the text input.

handle_info(arg1, state)

Handles messages to the text input.

init(props)

Initializes the text input state.

render(state, area)

Renders the text input.