Raxol.UI.Components.Input.TextInput (Raxol v0.5.0)
View SourceA text input component for capturing user text input.
Features:
- Customizable placeholder text
- Value binding
- Focus handling
- Character validation
- Input masking (for password fields)
- Event callbacks
Summary
Functions
Handles events for the TextInput component, such as keypresses, focus, blur, and mouse events.
Initializes the TextInput component state from the given props.
Mounts the TextInput component. Performs any setup needed after initialization.
Renders the TextInput component using the current state and context.
Unmounts the TextInput component, performing any necessary cleanup.
Updates the TextInput component state in response to messages or prop changes.
Types
@type props() :: %{ optional(:id) => String.t(), optional(:value) => String.t(), optional(:placeholder) => String.t(), optional(:on_change) => (String.t() -> any()), optional(:on_submit) => (String.t() -> any()), optional(:on_cancel) => (-> any()) | nil, optional(:theme) => map(), optional(:style) => map(), optional(:mask_char) => String.t() | nil, optional(:max_length) => integer() | nil, optional(:validator) => (String.t() -> boolean()) | nil }
@type state() :: %{ cursor_pos: non_neg_integer(), focused: boolean(), value: String.t(), placeholder: String.t(), max_length: non_neg_integer() | nil, validator: (String.t() -> boolean()) | nil, on_submit: (String.t() -> any()) | nil, on_change: (String.t() -> any()) | nil, mask_char: String.t() | nil, theme: map(), style: map() }
Functions
Handles events for the TextInput component, such as keypresses, focus, blur, and mouse events.
Initializes the TextInput component state from the given props.
Mounts the TextInput component. Performs any setup needed after initialization.
Renders the TextInput component using the current state and context.
Unmounts the TextInput component, performing any necessary cleanup.
Updates the TextInput component state in response to messages or prop changes.