# Defold Druid UI Library

# Module `druid.input`

Druid input text component.

Carry on user text input

### Info:

- Author: Part of code from Britzl gooey input component

## Functions

set_text(input_text) | Set text for input field
get_text() | Return current input field text
set_max_length(max_length) | Set maximum length for input field.
set_allowerd_characters(characters) | Set allowed charaters for input field.
reset_changes() | Reset current input selection and return previous value

## Tables

Events | Component events
Fields | Component fields
Style | Component style params.

## Functions

set_text(input_text)
  Set text for input field

  ### Parameters:

  - input_text string The string to apply for input field
get_text()
  Return current input field text

  ### Returns:

  string The current input field text
set_max_length(max_length)
  Set maximum length for input field. Pass nil to make input field unliminted (by default)

  ### Parameters:

  - max_length number Maximum length for input text field

  ### Returns:

  druid.input Current input instance
set_allowerd_characters(characters)
  Set allowed charaters for input field. See: https://defold.com/ref/stable/string/ ex: [%a%d] for alpha and numeric

  ### Parameters:

  - characters string Regulax exp. for validate user input

  ### Returns:

  druid.input Current input instance
reset_changes()
  Reset current input selection and return previous value

## Tables

Events
  Component events

  ### Fields:

  - on_input_select druid_event (self, button_node) On input field select callback
  - on_input_unselect druid_event (self, button_node) On input field unselect callback
  - on_input_text druid_event (self, input_text) On input field text change callback
  - on_input_empty druid_event (self, input_text) On input field text change to empty string callback
  - on_input_full druid_event (self, input_text) On input field text change to max length string callback
  - on_input_wrong druid_event (self, params, button_instance) On trying user input with not allowed character callback
Fields
  Component fields

  ### Fields:

  - text druid.text Text component
  - button druid.button Button component
  - is_selected bool Is current input selected now
  - is_empty bool Is current input is empty now
  - max_length number Max length for input text (optional)
  - allowerd_characters string Pattern matching for user input (optional)
  - keyboard_type number Gui keyboard type for input field
Style
  Component style params. You can override this component styles params in druid styles table or create your own style

  ### Fields:

  - IS_LONGTAP_ERASE bool Is long tap will erase current input data (default false)
  - MASK_DEFAULT_CHAR string Default character mask for password input (default *)
  - on_select function (self, button_node) Callback on input field selecting
  - on_unselect function (self, button_node) Callback on input field unselecting
  - on_input_wrong function (self, button_node) Callback on wrong user input
  - button_style table Custom button style for input node

generated by LDoc 1.4.6 Last updated 2020-06-14 20:13:02