View Source Surface.Components.Form.Checkbox (surface v0.11.4)

Defines a checkbox.

Provides a wrapper for Phoenix.HTML.Form's checkbox/3 function.

All options passed via opts will be sent to checkbox/3, value and class can be set directly and will override anything in opts.

Examples

<Checkbox form="user" field="color" opts={autofocus: "autofocus"} />

Properties

  • values :keyword, default: [] - List values that will be sent as part of the payload triggered by an event
  • form :form, from_context: {Surface.Components.Form, :form} - An identifier for the form
  • field :any, from_context: {Surface.Components.Form.Field, :field} - An identifier for the input
  • id :string - The id of the corresponding input field
  • name :string - The name of the corresponding input field
  • value :string - Value to pre-populated the input
  • class :css_class - Class or classes to apply to the input
  • opts :keyword, default: [] - Options list
  • checked_value :any, default: true - The value to be sent when the checkbox is checked. Defaults to "true"
  • hidden_input :boolean, default: true - Controls if this function will generate a hidden input to submit the unchecked value or not, defaults to "true".
  • unchecked_value :any, default: false - The value to be sent when the checkbox is unchecked, defaults to "false".

Events

  • capture_click - Triggered when the component captures click
  • click - Triggered when the component receives click
  • window_focus - Triggered when the page receives focus
  • window_blur - Triggered when the page loses focus
  • focus - Triggered when the component receives focus
  • blur - Triggered when the component loses focus
  • window_keyup - Triggered when a key on the keyboard is released (window-level)
  • window_keydown - Triggered when a key on the keyboard is pressed (window-level)
  • keyup - Triggered when a key on the keyboard is released
  • keydown - Triggered when a key on the keyboard is pressed

Summary

Functions

Callback implementation for Surface.Component.render/1.