mirror of
https://github.com/tabler/tabler.git
synced 2025-12-22 01:44:25 +04:00
added optgroup form examples (#1108)
* added optgroup form examples * added missing ts-dropdown class
This commit is contained in:
@@ -69,3 +69,25 @@ labels:
|
||||
people:
|
||||
value: 4
|
||||
data: people
|
||||
|
||||
optgroups:
|
||||
value: Optgroups
|
||||
data: optgroup
|
||||
options:
|
||||
-
|
||||
title: Tags
|
||||
options:
|
||||
- HTML
|
||||
- JavaScript
|
||||
- CSS
|
||||
- jQuery
|
||||
- Bootstrap
|
||||
- Ruby
|
||||
- Python
|
||||
-
|
||||
title: People
|
||||
options:
|
||||
- Chuck Tesla
|
||||
- Elon Musk
|
||||
- Paweł Kuna
|
||||
- Nikola Tesla
|
||||
|
||||
@@ -29,6 +29,21 @@
|
||||
<div {% if horizontal %}class="col"{% endif %}>
|
||||
<select class="form-select">
|
||||
<option>Option 1</option>
|
||||
<optgroup label="Optgroup 1">
|
||||
<option>Option 1</option>
|
||||
<option>Option 2</option>
|
||||
</optgroup>
|
||||
<option>Option 2</option>
|
||||
<optgroup label="Optgroup 2">
|
||||
<option>Option 1</option>
|
||||
<option>Option 2</option>
|
||||
</optgroup>
|
||||
<optgroup label="Optgroup 3">
|
||||
<option>Option 1</option>
|
||||
<option>Option 2</option>
|
||||
</optgroup>
|
||||
<option>Option 3</option>
|
||||
<option>Option 4</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
{% include ui/select.html key="users" %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Advanced select with optgroup</label>
|
||||
{% include ui/select.html key="optgroups" %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Select with avatars</label>
|
||||
{% include ui/select.html key="people" indicator="avatar" %}
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
<option value="{{ person.id }}"{% if include.indicator == 'avatar' %} data-custom-properties="{% capture indicator %}{% include ui/avatar.html size='xs' person=person %}{% endcapture %}{{ indicator | strip | escape }}"{% endif %}>{{ person.full_name }}</option>
|
||||
{% endfor %}
|
||||
|
||||
{% elsif data.data == 'optgroup' %}
|
||||
{% for group in options %}
|
||||
<optgroup label="{{ group.title }}">
|
||||
{% for option in group.options %}
|
||||
<option value="{{ option }}">{{ option }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
{% for option in options %}
|
||||
{% if option.first %}
|
||||
@@ -56,7 +65,7 @@
|
||||
var el;
|
||||
window.TomSelect && ({% if jekyll.environment == 'development' %}window.tabler_select["select-{{ id }}"] = {% endif %}new TomSelect(el = document.getElementById('select-{{ id }}'), {
|
||||
copyClassesToDropdown: false,
|
||||
dropdownClass: 'dropdown-menu',
|
||||
dropdownClass: 'dropdown-menu ts-dropdown',
|
||||
optionClass:'dropdown-item',
|
||||
|
||||
{% unless include.show-search %}
|
||||
|
||||
Reference in New Issue
Block a user