accordionHeader.ftl

 1   <#--
 2   Macro: accordionHeader
 3   
 4   Description: Generates an HTML header element for an accordion-style UI element with expandable and collapsible content.
 5   
 6   Parameters:
 7   - id (string, optional): the ID of the header element. If not provided, a default ID will be generated.
 8   - title (string, required): the title of the header element.
 9   - parentId (string, required): the ID of the parent element.
 10   - childId (string, required): the ID of the child element.
 11   - boxTools (boolean, optional): whether to include box tools for the header element.
 12   - params (string, optional): additional HTML attributes to include in the header element.
 13   - headerIcon (string, optional): the name of the icon to include in the header element.
 14   -->
 15   <#macro accordionHeader id='' title='' parentId=parentId childId=childId boxTools=false params='' headerIcon='' >
 16   <div class="accordion-item">
 17   	<h2 class="accordion-header" id="${childId}-header"<#if params!=''> ${params}</#if>>
 18   		<button class="accordion-button<#if aClass!=''> ${aClass}</#if>" type="button" data-bs-toggle="collapse" data-bs-target="#${childId}" aria-expanded="${expanded}" aria-controls="${childId}">
 19   		<#if headerIcon!=''><@icon style=headerIcon /></#if><span class="ms-2">${title}</span>
 20   	</h2>
 21   	<#local nested><#nested></#local>
 22   	<#if nested?has_content><#if boxTools><div class="box-tools"></#if>${nested}<#if boxTools></div></#if></#if>
 23   </div>
 24   <#assign parentId = parentId />
 25   </#macro>