Raxol.UI.Components.Input.MultiLineInput (Raxol v2.6.0)

View Source

A multi-line input component for text editing, supporting line wrapping, scrolling, selection, and accessibility.

BREAKING: All styling is now theme-driven. The style field and @default_style are removed. Use the theme system for all appearance customization.

Harmonized with modern Raxol component standards (style/theme merging, lifecycle hooks, accessibility props).

Summary

Types

t()

State for the MultiLineInput component. See @type t for field details.

Functions

Handles events for the MultiLineInput component, such as keypresses, mouse events, and context changes.

Initializes the MultiLineInput state, splitting value into lines for editing.

Mounts the MultiLineInput component. Performs any setup needed after initialization.

Renders the MultiLineInput component using the current state and context.

Unmounts the MultiLineInput component, performing any necessary cleanup.

Types

t()

@type t() :: %Raxol.UI.Components.Input.MultiLineInput{
  aria_label: String.t() | nil,
  cursor_pos: {integer(), integer()},
  desired_col: integer() | nil,
  focused: boolean(),
  height: integer(),
  history: %{undo: list(), redo: list()},
  id: String.t() | nil,
  lines: [String.t()],
  on_change: (String.t() -> any()) | nil,
  on_submit: (-> any()) | nil,
  placeholder: String.t(),
  scroll_offset: {integer(), integer()},
  selection_end: {integer(), integer()} | nil,
  selection_start: {integer(), integer()} | nil,
  shift_held: boolean(),
  theme: map(),
  tooltip: String.t() | nil,
  value: String.t(),
  width: integer(),
  wrap: :none | :char | :word
}

State for the MultiLineInput component. See @type t for field details.

Functions

ensure_cursor_visible(state)

handle_blur(state)

handle_event(event, state, context)

Handles events for the MultiLineInput component, such as keypresses, mouse events, and context changes.

handle_focus(state)

handle_redo(state)

handle_set_shift_held(held, state)

handle_undo(state)

handle_unknown_message(msg, state)

handle_update_props(new_props, state)

init(props)

@spec init(map()) :: {:ok, t()}

Initializes the MultiLineInput state, splitting value into lines for editing.

mount(state)

@spec mount(t()) :: t()

Mounts the MultiLineInput component. Performs any setup needed after initialization.

render(state, context)

Renders the MultiLineInput component using the current state and context.

trigger_on_change(arg, old_state)

unmount(state)

@spec unmount(t()) :: t()

Unmounts the MultiLineInput component, performing any necessary cleanup.