# Module `druid.button`

Component to handle basic GUI button

## Functions

init(node, callback[, params[, anim_node]]) | Component init function
set_enabled(state) | Set enabled button component state
is_enabled() | Return button enabled state
set_click_zone(zone) | Strict button click area.
set_key_trigger(key) | Set key-code to trigger this button
get_key_trigger() | Get key-code to trigger this button

## Tables

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

## Functions

init(node, callback[, params[, anim_node]])
  Component init function

  ### Parameters:

  - node node Gui node
  - callback function Button callback
  - params table Button callback params (optional)
  - anim_node node Button anim node (node, if not provided) (optional)
set_enabled(state)
  Set enabled button component state

  ### Parameters:

  - state bool Enabled state
is_enabled()
  Return button enabled state

  ### Returns:

  bool True, if button is enabled
set_click_zone(zone)
  Strict button click area. Useful for no click events outside stencil node

  ### Parameters:

  - zone node Gui node
set_key_trigger(key)
  Set key-code to trigger this button

  ### Parameters:

  - key hash The action_id of the key
get_key_trigger()
  Get key-code to trigger this button

  ### Returns:

  hash The action_id of the key

## Tables

Events
  Component events

  ### Fields:

  - on_click druid_event (self, params, button_instance) On release button callback
  - on_repeated_click druid_event (self, params, buttoninstance, clickamount) On repeated action button callback
  - on_long_click druid_event (self, params, button_instance, time) On long tap button callback
  - on_double_click druid_event (self, params, buttoninstance, clickamount) On double tap button callback
  - on_hold_callback druid_event (self, params, buttoninstance, time) On button hold before longclick callback
Fields
  Component fields

  ### Fields:

  - node node Trigger node
  - anim_node node Animation node (default node)
  - start_scale vector3 Initial scale of anim_node
  - pos vector3 Initial pos of anim_node
  - params any Params to click callbacks
  - hover druid.hover Druid hover logic component
  - click_zone node Restriction zone (optional)
Style
  Component style params

  ### Fields:

  - on_click function (self, node)
  - on_click_disabled function (self, node)
  - on_hover function (self, node, hover_state)
  - on_set_enabled function (self, node, enabled_state)
  - IS_HOVER bool

generated by LDoc 1.4.6 Last updated 2020-04-09 22:11:32