Switch

Switch

  •         {% include "@Components/forms/switch/switch.twig" with {
      props : {
        id: "switch-button",
        value: "switch",
        label: "Switch",
        name: "switch"
      }
    } %}
    
          
  •                 <div class="switch">
      <input type="checkbox" id="switch-button" name="switch" value="switch">
      <label class="f-label" for="switch-button">
      <span class="f-label__title">Switch</span>
    </label>
    </div>
    
            

Switch checked

  •         {% include "@Components/forms/switch/switch.twig" with {
      props : {
        id: "switch-button-checked",
        value: "switch-checked",
        label: "Checked switch",
        name: "switch-checked",
        checked: true
      }
    } %}
    
          
  •                   <div class="switch">
      <input type="checkbox" id="switch-button-checked" name="switch-checked" value="switch-checked" checked="checked">
      <label class="f-label" for="switch-button-checked">
      <span class="f-label__title">Checked switch</span>
    </label>
    </div>
    
            

Switch disabled

  •         {% include "@Components/forms/switch/switch.twig" with {
      props : {
        id: "switch-button-disabled",
        value: "switch-disabled",
        label: "Disabled switch",
        name: "switch-disabled",
        disabled: true
      }
    } %}
    
          
  •                   <div class="switch">
      <input type="checkbox" id="switch-button-disabled" name="switch-disabled" value="switch-disabled" disabled>
      <label class="f-label" for="switch-button-disabled">
      <span class="f-label__title">Disabled switch</span>
    </label>
    </div>
    
            

Switch disabled + checked

  •         {% include "@Components/forms/switch/switch.twig" with {
      props : {
        id: "switch-button-disabled-checked",
        value: "switch-disabled-checked",
        label: "Disabled checked switch",
        name: "switch-disabled-checked",
        checked: true,
        disabled: true
      }
    } %}
    
          
  •                     <div class="switch">
      <input type="checkbox" id="switch-button-disabled-checked" name="switch-disabled-checked" value="switch-disabled-checked" checked="checked" disabled>
      <label class="f-label" for="switch-button-disabled-checked">
      <span class="f-label__title">Disabled checked switch</span>
    </label>
    </div>
    
            

Schema

    {
  "props": {
    "id": {
      "type": "string",
      "description": "id of input"
    },
    "value": {
      "type": "string",
      "description": "value of input"
    },
    "label": {
      "type": "string",
      "description": "label of input"
    },
    "name": {
      "type": "string",
      "description": "name of input"
    },
    "checked": {
      "type": "boolean",
      "description": "true | undefined"
    },
    "required": {
      "type": "boolean",
      "description": "true | undefined"
    },
    "disabled": {
      "type": "boolean",
      "description": "true | undefined"
    },
    "hideLabel": {
      "type": "boolean",
      "description": "Popisek jen pro čtečky, vykreslí se samotný ovladač (např. řádek kanálu hlídače)"
    },
    "attributes": {
      "type": "array",
      "description": "Raw attributes appended to the input"
    },
    "extraClass": {
      "type": "string",
      "description": "Extra CSS class"
    }
  }
}