ShadcnUI.Components.Forms.Switch (shadcn_ui v1.0.0)

Copy Markdown View Source

Switch presentation of the native boolean Checkbox contract.

Switch delegates identity, checked state, hidden sentinel, relationships, and submission to Checkbox. It adds only track-and-thumb presentation. There is no role-only substitute, event API, synchronized state, or toggle method.

Summary

Functions

Renders a native boolean checkbox with switch presentation.

Functions

switch(assigns)

Renders a native boolean checkbox with switch presentation.

Attributes

  • field (:any) - Defaults to nil.
  • id (:string) - Defaults to nil.
  • name (:string) - Defaults to nil.
  • value (:any) - Defaults to {:shadcn_ui, :not_provided}.
  • checked (:boolean) - Defaults to nil.
  • checked_value (:string) - Defaults to "true".
  • unchecked_value (:string) - Defaults to "false".
  • errors (:any) - Defaults to {:shadcn_ui, :not_provided}.
  • error_mode (:atom) - Defaults to :used_input. Must be one of :used_input, :always, or :hidden.
  • used (:boolean) - Defaults to false.
  • translate_error (:any) - Defaults to nil.
  • pending (:boolean) - Defaults to false.
  • required (:boolean) - Defaults to false.
  • optional (:boolean) - Defaults to false.
  • disabled (:boolean) - Defaults to false.
  • form (:string) - Defaults to nil.
  • label_visibility (:atom) - Defaults to :visible. Must be one of :visible, or :hidden.
  • accessible_label (:string) - Defaults to nil.
  • describedby (:any) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • field_class (:any) - Defaults to nil.
  • label_class (:any) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["autofocus"].

Slots

  • label (required)
  • help