ElixirOpentui.Widgets.TextInput (ElixirOpentui v0.2.0)

Copy Markdown View Source

Interactive text input widget.

Manages cursor position, text editing, scroll offset for long text, and emits on_change/on_submit messages to the parent via _pending.

Props (mount-time only)

  • :value — initial text value
  • :placeholder — placeholder text when empty
  • :on_change — message tag sent as {tag, new_value} on edit
  • :on_submit — message tag sent as {tag, value} on Enter
  • :max_length — maximum character count (default: :infinity)
  • :width — display width
  • :id — element id (required for focus)
  • :cursor_style — :block | :underline | :bar (default: :block)

  • :focused_bg — background color when focused
  • :focused_fg — foreground color when focused
  • :placeholder_fg — foreground color for placeholder text
  • :cursor_fg — foreground color for cursor cell
  • :cursor_bg — background color for cursor cell