{% macro onsSelect(params) %}
    {% from "components/field/_macro.njk" import onsField %}
    {% from "components/label/_macro.njk" import onsLabel %}

    {%
        call onsField({
            "id": params.fieldId,
            "classes": params.fieldClasses,
            "legendClasses": params.legendClasses,
            "dontWrap": params.dontWrap,
            "error": params.error,
            "inline": params.label.inline if params.label
        })
    %}
        {{
            onsLabel({
                "for": params.id,
                "text": params.label.text,
                "description": params.label.description,
                "classes": params.label.classes
            })
        }}
        <select
            id="{{ params.id }}"
            name="{{ params.name }}"
            class="ons-input ons-input--select{{ ' ' + params.classes if params.classes else '' }}{{ ' ons-input--error' if params.error }}"
            {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
        >
            {% for option in params.options %}
                <option
                    value="{{ option.value | default(option.text) }}"
                    {% if option.id %}{{ ' ' }}id="{{ option.id }}"{% endif %}
                    {% if option.selected %}{{ ' ' }}selected{% endif %}
                    {% if option.disabled %}{{ ' ' }}disabled{% endif %}
                    {% if option.attributes %}{% for attribute, value in option.attributes %}{{ ' ' }}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
                >
                    {{- option.text -}}
                </option>
            {% endfor %}
        </select>
    {% endcall %}
{% endmacro %}
