<div x-data="{ expanded: false }" class=" text-neutral-800">
<h2 class="font-semibold">
<button type="button" @click="expanded = !expanded " class="flex justify-between items-center w-full ">
<span class="flex flex-wrap gap-3">
Accordion title
</span>
<span :class="expanded ? 'rotate-180' : ''" class="transform transition-transform duration-300">
<svg class=" shrink-0" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.5303 14.5303C12.2374 14.8232 11.7626 14.8232 11.4697 14.5303L7.46967 10.5303C7.17678 10.2374 7.17678 9.76256 7.46967 9.46967C7.76256 9.17678 8.23744 9.17678 8.53033 9.46967L12 12.9393L15.4697 9.46967C15.7626 9.17678 16.2374 9.17678 16.5303 9.46967C16.8232 9.76256 16.8232 10.2374 16.5303 10.5303L12.5303 14.5303Z" fill="currentColor" />
</svg>
</span>
</button>
</h2>
<div x-cloak x-show="expanded" x-collapse class="pt-6">
Accordion content
</div>
</div>
<div
x-data="{ expanded: {{ expanded ? 'true' : 'false' }} }"
class="{{ accordion_class }} {{ color == 'light' ? 'text-light-white' : 'text-neutral-800' }}">
<h2 class="{{ accordion_title_class|default('font-semibold') }}">
<button type="button" @click="expanded = !expanded "
class="flex justify-between items-center w-full {{ accordion_button_class }}">
<span class="flex flex-wrap gap-3">
{% if startIcon is defined and startIcon %}
{% render "@icons-" ~ startIcon.name|default("library--user-team") with {size: icon.size,iconClass: icon.class} %}
{% endif %}
{{ title }}
</span>
<span :class="expanded ? 'rotate-180' : ''"
class="transform transition-transform duration-300">
{% render "@icons-library--chevron-bottom" with chevronIcon %}
</span>
</button>
</h2>
<div x-cloak x-show="expanded" x-collapse class="{{ accordion_content_class|default('pt-6') }}">
{% block content '' %}
{{ content }}
</div>
</div>
{
"title": "Accordion title",
"content": "Accordion content"
}
{% embed "@accordion" with {...} %}
{% block content %}
...
{% endblock %}
{% endembed %}
{% embed "@accordion--mobile-only" with {...} %}
{% block content %}
...
{% endblock %}
{% endembed %}
string
| default: Accordion title
string
| default: null
string
| default: null
string
| default: null
boolean
| default: false
string
| default: null
| (prefer using the content block via embed)