Checkbox

Checkboxes are used as a list in our forms and signup pages so users can select options of their choice. Users are free to choose how many options to select, from zero to all of them.

As each checkbox is independent, this means that additional checkboxes do not affect any other selections… or planets.

Checkbox

State
@user_changeset = #Ecto.Changeset<
  action: nil,
  changes: %{agrees_to_terms_of_service: false},
  errors: [
    agrees_to_terms_of_service: {"please accept terms of service",
     [validation: :inclusion, enum: [true]]}
  ],
  data: #MoonWeb.Pages.Tutorials.AddDataUsingForm.User<>,
  valid?: false
>

No Label

Disabled

ReadOnly

Checkbox props
Name Type Required Default Description
checked boolean No false Preset value for checkbox state
disabled boolean No false Checkbox disabled state
readonly boolean No false Checkbox isn't disabled but its value can't be changed
field atom Yes - Field name for the inner input form control
#slot element Yes - Label for the control