Switch

Renders a switch component.

Read more Read less

Props

  • :id - The id to be applied to the input element
  • :name - The name to be applied to the input element
  • :class - Additional CSS classes
  • :value - The current value of the switch
  • :default-value - The default value of the switch
  • :field - Phoenix form field
  • :disabled - Whether the switch is disabled
  • :on-checked-changed - Handler for value change event
Attribute Type Documentation Default Value
id :string
name :string
class :string
checked :boolean false
disabled :boolean false
on-checked-changed :any

Handler for value change event

field %FormField{}

a form field struct retrieved from the form, for example: @form[:active]

rest :global