1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00
Files
tabler/shared/includes/ui/form/check.html
2025-04-15 23:18:49 +02:00

26 lines
1.5 KiB
HTML

{% assign type = include.type | default: 'checkbox' %}
{% assign checked = include.checked | default: false %}
{% assign disabled = include.disabled | default: false %}
{% assign switch = include.switch | default: false %}
{% assign title = include.title | default: false %}
{% assign name = include.name | default: false %}
{% assign is_empty = include['empty'] | default: false %}
{% unless title %}
{% assign title = '' %}
{% if disabled %}{% assign title = title | append: ' disabled' %}{% endif %}
{% if checked %}{% assign title = title | append: ' checked' %}{% endif %}
{% if switch %}{% assign title = title | append: ' switch' %}{% endif %}
{% assign title = title | append: ' ' | append: type %}
{% assign title = title | append: ' input' | lstrip | capitalize %}
{% endunless %}
<label class="form-check{% if include.inline %} form-check-inline{% endif %}{% if switch %} form-switch{% if include['size'] %} form-switch-{{ include['size'] }}{% endif %}{% endif %}{% if include.class %} {{ include.class }}{% endif %}">
<input class="form-check-input{% if is_empty %} position-static{% endif %}" type="{{ type }}" {% if name %}
name="{{ name }}" {% endif %}{% if checked %} checked{% endif %}{% if disabled %} disabled{% endif %}>
{% if include.title-on and include.title-off %}
<span class="form-check-label form-check-label-on">{{include.title-on }}</span>
<span class="form-check-label form-check-label-off">{{include.title-off }}</span>
{% else %}
{% unless is_empty %}<span class="form-check-label">{{ title }}</span>{% endunless %}
{% endif %}
</label>