{% macro onsDetails(params) %}
    <div
        id="{{ params.id }}"
        class="ons-details ons-js-details{{ ' ons-details--accordion' if params.isAccordion }}{{ ' ' + params.classes if params.classes else '' }}"
        {% if params.group %}{{ ' ' }}data-group="{{ params.group }}"{% endif %}
        {% 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 %}
        {% if params.saveState %}{{ ' ' }}data-save-state="true"{% endif %}
        {% if params.open %}{{ ' ' }}data-open="true"{% endif %}
    >
        <div
            class="ons-details__heading ons-js-details-heading"
            role="button"
            {% if params.headingAttributes %}{% for attribute, value in (params.headingAttributes.items() if params.headingAttributes is mapping and params.headingAttributes.items else params.headingAttributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
        >
            {% set titleTag = params.headingLevel | default(2) %}
            {% set openingTag = "<h" ~ titleTag %}
            {% set closingTag = "</h" ~ titleTag ~ ">" %}
            {{ openingTag | safe }}
            class="ons-details__title ons-u-fs-r--b">{{ params.title }}{{ closingTag | safe }}
            <span class="ons-details__icon">
                {% from "components/icon/_macro.njk" import onsIcon %}
                {{-
                    onsIcon({
                        "iconType": "chevron"
                    })
                -}}</span
            >
        </div>
        <div
            id="{{ params.id }}-content"
            class="ons-details__content ons-js-details-content"
            {% if params.contentAttributes %}{% for attribute, value in (params.contentAttributes.items() if params.contentAttributes is mapping and params.contentAttributes.items else params.contentAttributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
        >
            {{ params.content | safe }}{{ caller() if caller }}
        </div>
    </div>
{% endmacro %}
