Raxol.UI.Components.Input.SingleLineInput (Raxol v2.0.1)

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.

Mount hook - called when component is mounted. No special setup needed for SingleLineInput.

Renders the SingleLineInput component using the current state and props.

Unmount hook - called when component is unmounted. No cleanup needed for SingleLineInput.

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)

@spec mount(map()) :: {map(), list()}

Mount hook - called when component is mounted. No special setup needed for SingleLineInput.

render(state, props)

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

Renders the SingleLineInput component using the current state and props.

schedule(msg, delay)

unmount(state)

@spec unmount(map()) :: map()

Unmount hook - called when component is unmounted. No cleanup needed for SingleLineInput.

update(msg, state)

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

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