Switch¶
-
/libs/granite/ui/components/foundation/form/switch
A switch component to represent boolean concept (the “On”/”Off” toggle switch).
It extends
Field
component.It has the following content structure:
- granite:FormSwitch
- idstring
The id attribute.
- relstring
The class attribute. This is used to indicate the semantic relationship of the component similar to
rel
attribute.
- classstring
The class attribute.
- titlestring
- i18n
The title attribute.
- namestring
The name that identifies the field when submitting the form.
-
deleteHintboolean
- true
true
to generate the SlingPostServlet @Delete hidden input based on the name.
-
valuestring
- true
The submit value of the field when it is checked.
-
uncheckedValuestring
- false
The submit value of the field when it is unchecked.
- disabledboolean
Indicates if the field is in disabled state.
- requiredboolean
Indicates if the field is mandatory to be filled.
- validationstring
- multiple
The name of the validator to be applied. E.g.
foundation.jcr.name
. See validation in Granite UI.
- checkedboolean
Indicates if the checkbox is checked. Providing
checked
property (eithertrue
orfalse
) will implyignoreData
to betrue
, and will set the checked state based on this property.
- ignoreDataboolean
If
false
, the checked state is based on matching the form values byname
andvalue
properties. Otherwise, the form values are ignored, and the checked state is based ondefaultChecked
property specified.
- defaultCheckedboolean
true
to pre-check this field,false
otherwise.
-
onTextstring
- On
- i18n
The text for “On”.
-
offTextstring
- Off
- i18n
The text for “Off”.
- fieldLabelstring
- i18n
The label of the component.
- fieldDescriptionstring
- i18n
The description of the component.
- renderReadOnlyboolean
Renders the read-only markup as well.
- showEmptyInReadOnlyboolean
Shows read-only version even when it is unchecked.