Switch ====== .. granite:servercomponent:: /libs/granite/ui/components/foundation/form/switch :supertype: /libs/granite/ui/components/foundation/form/field :deprecated: A switch component to represent boolean concept (the "On"/"Off" toggle switch). It extends :granite:servercomponent:`Field ` component. It has the following content structure: .. gnd:gnd:: [granite:FormSwitch] /** * The id attribute. */ - id (String) /** * The class attribute. This is used to indicate the semantic relationship of the component similar to ``rel`` attribute. */ - rel (String) /** * The class attribute. */ - class (String) /** * The title attribute. */ - title (String) i18n /** * The name that identifies the field when submitting the form. */ - name (String) /** * ``true`` to generate the `SlingPostServlet @Delete `_ hidden input based on the name. */ - deleteHint (Boolean) = true /** * The submit value of the field when it is checked. */ - value (String) = 'true' /** * The submit value of the field when it is unchecked. */ - uncheckedValue (String) = 'false' /** * Indicates if the field is in disabled state. */ - disabled (Boolean) /** * Indicates if the field is mandatory to be filled. */ - required (Boolean) /** * The name of the validator to be applied. E.g. ``foundation.jcr.name``. * See :doc:`validation ` in Granite UI. */ - validation (String) multiple /** * Indicates if the checkbox is checked. * Providing ``checked`` property (either ``true`` or ``false``) will imply ``ignoreData`` to be ``true``, * and will set the checked state based on this property. */ - checked (Boolean) /** * If ``false``, the checked state is based on matching the form values by ``name`` and ``value`` properties. * Otherwise, the form values are ignored, and the checked state is based on ``defaultChecked`` property specified. */ - ignoreData (Boolean) /** * ``true`` to pre-check this field, ``false`` otherwise. */ - defaultChecked (Boolean) /** * The text for "On". */ - onText (String) = 'On' i18n /** * The text for "Off". */ - offText (String) = 'Off' i18n /** * The label of the component. */ - fieldLabel (String) i18n /** * The description of the component. */ - fieldDescription (String) i18n /** * Renders the read-only markup as well. */ - renderReadOnly (Boolean) /** * Shows read-only version even when it is unchecked. */ - showEmptyInReadOnly (Boolean)