{#
/**
 * @file
 * Template for Checkbox component.
 */
#}
{% set name = name|default(id) %}
{% set checked = checked|default(false) %}
{% set disabled = disabled|default(false) %}
{% set error = error|default(false) %}

{% set wrapper_classes = [
  'kern-form-check',
  error ? 'kern-form-check__checkbox--error',
] %}

<div {{ attributes.addClass(wrapper_classes) }}>
  <input
    class="kern-form-check__checkbox"
    id="{{ id }}"
    name="{{ name }}"
    type="checkbox"
    {% if value %}value="{{ value }}"{% endif %}
    {% if checked %}checked{% endif %}
    {% if disabled %}disabled{% endif %}
  />
  <label class="kern-label" for="{{ id }}">
    {{ label }}
  </label>
</div>

