View Source Moon.Design.Form.Checkbox (Moon v2.77.0)

Checkbox to be rendered on form. Label is the root component. For rebdering outside the from please use Moon.Lego.Checkbox


  • field :atom, from_context: {Surface.Components.Form.Field, :field} - Field name, surface-style
  • form :form, from_context: {Surface.Components.Form, :form} - Form, surface-style
  • label :string - Label to be shown to user
  • disabled :boolean - If the field is disabled
  • readonly :boolean - If the field is read-only
  • id :string - Id to be given to the HTML tag
  • testid :string - Data-testid attribute value
  • class :css_class - Class to be given to the visible checkbox
  • checkbox_label_class :css_class - Additional Tailwind classes for checkbox label
  • 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".
  • is_multiple :boolean - Adding [] to the field name for support multiple checkboxes with the same name
  • size :string, values!: ~w(sm md lg), default: "md" - Size of the label


  • default - Inner content - put label here


  • on_click - On_click event for the checkbox



Callback implementation for Surface.Component.render/1.