Google Apps Script API
    Preparing search index...

    A UI element that supports being toggled on or off. This can only be used within a KeyValue widget.

    var switchKeyValue = CardService.newKeyValue()
        .setTopLabel("Switch key value widget label")
        .setContent("This is a key value widget with a switch on the right")
        .setSwitch(CardService.newSwitch()
            .setFieldName("form_input_switch_key")
            .setValue("form_input_switch_value")
            .setControlType(CardService.SwitchControlType.SWITCH)
            .setOnChangeAction(CardService.newAction()
                .setFunctionName("handleSwitchChange")));
    
    interface Switch {
        setControlType(type: SwitchControlType): Switch;
        setFieldName(fieldName: string): Switch;
        setOnChangeAction(action: GoogleAppsScript.Card_Service.Action): Switch;
        setSelected(selected: boolean): Switch;
        setValue(value: string): Switch;
    }
    Index

    Methods