Raxol.UI.Components.Input.SingleLineInput (Raxol v0.5.0)

View Source

A simple single-line text input component.

Summary

Types

t()

State for the SingleLineInput component.

Functions

Handles events for the SingleLineInput component, such as keypresses and mouse clicks.

Initializes the SingleLineInput component state from the given props.

Renders the SingleLineInput component using the current state and props.

Updates the SingleLineInput component state in response to messages or prop changes.

Types

t()

@type t() :: %Raxol.UI.Components.Input.SingleLineInput{
  cursor_pos: non_neg_integer(),
  focused: boolean(),
  id: any(),
  on_change: (String.t() -> any()) | nil,
  on_submit: (-> any()) | nil,
  placeholder: String.t(),
  style: map(),
  value: String.t()
}

State for the SingleLineInput component.

  • :id - unique identifier
  • :value - current text value
  • :placeholder - placeholder text
  • :style - style map
  • :focused - whether the field is focused
  • :cursor_pos - cursor position
  • :on_change - callback for value change
  • :on_submit - callback for submit action

Functions

broadcast(msg)

command(cmd)

handle_event(event, props, state)

@spec handle_event(term(), map(), t()) :: {t(), list()}

Handles events for the SingleLineInput component, such as keypresses and mouse clicks.

init(props)

@spec init(map()) :: t()

Initializes the SingleLineInput component state from the given props.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

render(state, props)

@spec render(t(), map()) :: any()

Renders the SingleLineInput component using the current state and props.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(msg, state)

@spec update(term(), t()) :: {t(), list()}

Updates the SingleLineInput component state in response to messages or prop changes.