core/template/components/form_dropdown.html

16 lines
No EOL
622 B
HTML

{{define "form_dropdown_item"}}
<li><a class="dropdown-item {{if eq .IsActive true}}active{{end}} {{if eq .IsDisabled true}}disabled{{end}}" href="{{.Link}}">{{.Text}}</a></li>
{{end}}
{{define "form_dropdown"}}
<div class="dropdown">
<button class="btn btn-{{.TypeClass}} dropdown-toggle {{if eq .IsDisabled true}}disabled{{end}}" type="button" data-bs-toggle="dropdown" aria-expanded="false">
{{.Label}}
</button>
<ul class="dropdown-menu">
{{ range .Items}}
{{template "form_dropdown_item" .}}
{{end}}
</ul>
</div>
{{end}}