View Source SaladUI.Switch (SaladUI v1.0.0-beta.1)
Implementation of a switch/toggle component.
A switch is a control that allows users to toggle between checked and not checked states.
Summary
Functions
Renders a switch component.
Functions
Renders a switch component.
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
Attributes
id
(:string
) - Defaults tonil
.name
(:string
) - Defaults tonil
.class
(:string
) - Defaults tonil
.checked
(:boolean
) - Defaults tofalse
.disabled
(:boolean
) - Defaults tofalse
.on-checked-changed
(:any
) - Handler for value change event. Defaults tonil
.field
(Phoenix.HTML.FormField
) - a form field struct retrieved from the form, for example: @form[:active].- Global attributes are accepted.