components
Tailwind CSS Accordion
Utilize the accordion feature to reveal concealed content by toggling the collapse and expand states of its child elements, employing data attribute options.
Class Name | Type | Description |
---|---|---|
accordion | Component | Container class for an accordion group. |
accordion-item | Component | Container class for a single accordion. |
accordion-toggle | Component | Class for accordion button. |
accordion-content | Component | Accordion content class. |
accordion-bordered | Modifier | Apply Bordered style. |
accordion-shadow | Modifier | Apply shadow style. |
accordion-item-active:{tw-utility-class} | Modifier | Apply tailwind classes when the accordion item is active. |
active | Modifier | Active accordion item. |
Basic accordion example.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-basic">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-basic-collapse" aria-expanded="true" >
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-basic-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-basic" role="region" >
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-basic">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="delivery-basic-collapse" aria-expanded="false" >
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-basic-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-basic" role="region" >
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-basic">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="cancel-basic-collapse" aria-expanded="false" >
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel-basic-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-basic" role="region" >
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
To ensure that accordion items remain open even when another item is opened, set the data-accordion-always-open
attribute as shown below.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y" data-accordion-always-open="">
<div class="accordion-item active" id="payment-always">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-always-collapse" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-always-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-always" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-always">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="delivery-always-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-always-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-always" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-always">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="cancel-always-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel-alawys-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-alawys" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
Active content will display with a border. You can use the accordion-item-active:{tw-utility-class}
to define the style for an accordion item when it is active, using Tailwind classes.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion max-w-lg">
<div class="accordion-item active accordion-item-active:border accordion-item-active:rounded-box accordion-item-active:border-base-content/25" id="payment-border-active">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-border-active-collapse" aria-expanded="true" aria-labelledby="payment-border-active-heading">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
<span id="payment-border-active-heading">When is payment taken for my order?</span>
</button>
<div id="payment-border-active-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-border-active-heading" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item accordion-item-active:border accordion-item-active:rounded-box accordion-item-active:border-base-content/25" id="delivery-border-active">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="delivery-border-active-collapse" aria-expanded="false" aria-labelledby="delivery-border-active-heading">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
<span id="delivery-border-active-heading">How would you ship my order?</span>
</button>
<div id="delivery-border-active-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-border-active-heading" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item accordion-item-active:border accordion-item-active:rounded-box accordion-item-active:border-base-content/25" id="cancel-border-active">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="cancel-border-active-collapse" aria-expanded="false" aria-labelledby="cancel-border-active-heading">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
<span id="cancel-border-active-heading">Can I cancel my order?</span>
</button>
<div id="cancel-border-active-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-border-active-heading" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
Apply the accordion-shadow
modifier class alongside the accordion
component class to add a shadow effect to all accordion-item
elements.
To modify the shadow color for active items, use the accordion-item-active:
modifier.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion accordion-shadow max-w-lg">
<div class="accordion-item active" id="payment-shadow">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="payment-shadow-collapse" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-shadow-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-shadow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-shadow">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="delivery-shadow-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-shadow-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-shadow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel̉-shadow">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="cancel̉-shadow-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel̉-shadow-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel̉-shadow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
You can improve the visual presentation of the accordion item when it’s active by adding the accordion-item-active
class. For example, you could modify its size to create a noticeable distinction when it’s in the active state.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion accordion-shadow max-w-lg">
<div class="accordion-item accordion-item-active:scale-[1.05] accordion-item-active:mb-3 active transition-transform ease-in duration-300 delay-[1ms]" id="payment-popout" >
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="payment-popout-collapse" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-popout-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-popout" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item accordion-item-active:scale-[1.05] accordion-item-active:my-3 transition-transform ease-in duration-300 delay-[1ms]" id="delivery-popout" >
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="delivery-popout-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-popout-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-popout" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item accordion-item-active:scale-[1.05] accordion-item-active:mt-3 transition-transform ease-in duration-300 delay-[1ms]" id="cancel-popout" >
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="cancel-popout-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel-popout-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-popout" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
A simple accordion layout featuring a submenu.
We accept Visa®, MasterCard®, American Express®, and PayPal®. Our servers encrypt all information submitted to them, so you can be confident that your credit card information will be kept safe and secure.
No, This is not subscription based item. Pastry pudding cookie toffee bonbon jujubes jujubes powder topping. Jelly beans gummi bears sweet roll bonbon muffin liquorice. Wafer lollipop sesame snaps.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-nested">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-nested-collapse" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Payment
</button>
<div id="payment-nested-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-nested" role="region">
<div class="accordion divide-neutral/20 divide-y ps-6">
<div class="accordion-item active" id="payment-sub-one">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-sub-collapse-one" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How do I pay for my order?
</button>
<div id="payment-sub-collapse-one" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-sub-one" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
We accept Visa®, MasterCard®, American Express®, and PayPal®. Our servers encrypt all information
submitted to them, so you can be confident that your credit card information will be kept safe and
secure.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="payment-sub-two">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-sub-collapse-two" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Does my subscription automatically renew?
</button>
<div id="payment-sub-collapse-two" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-sub-two" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
No, This is not subscription based item. Pastry pudding cookie toffee bonbon jujubes jujubes powder
topping. Jelly beans gummi bears sweet roll bonbon muffin liquorice. Wafer lollipop sesame snaps.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-nested">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="delivery-nested-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-nested-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-nested" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-nested">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="cancel-nested-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel-nested-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-nested" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
A simple accordion design that includes an arrow.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-arrow">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-arrow-collapse" aria-expanded="true">
<span class="icon-[tabler--chevron-right] accordion-item-active:rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:rotate-180" ></span>
When is payment taken for my order?
</button>
<div id="payment-arrow-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-arrow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-arrow">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="delivery-arrow-collapse" aria-expanded="false">
<span class="icon-[tabler--chevron-right] accordion-item-active:rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:rotate-180" ></span>
How would you ship my order?
</button>
<div id="delivery-arrow-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-arrow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-arrow">
<button class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="cancel-arrow-collapse" aria-expanded="false">
<span class="icon-[tabler--chevron-right] accordion-item-active:rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:rotate-180" ></span>
Can I cancel my order?
</button>
<div id="cancel-arrow-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-arrow" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
The below example is the accordion with avatar.
Richard Payne is a remarkable individual known for his exceptional skills and expertise in various fields. With a strong background in technology and a passion for innovation, Richard has made significant contributions to the industry.
Jordan Stevenson is a talented individual with a passion for technology and innovation. Jordan has made significant contributions to various projects and has a deep understanding of programming languages and frameworks.
Nicholas Tanner is a highly skilled individual with a strong passion for technology and innovation. Nicholas has made significant contributions to numerous projects and possesses a deep understanding of various programming languages and frameworks.
<div class="accordion accordion-shadow max-w-lg">
<div class="accordion-item active" id="payment-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="payment-arrow-right-collapse" aria-expanded="true">
<div class="flex gap-4">
<div class="avatar">
<div class="size-12 rounded-md">
<img src="https://cdn.flyonui.com/fy-assets/avatar/avatar-2.png" alt="avatar" />
</div>
</div>
<div>
<p class="mb-0.5">Richard Payne</p>
<p class="text-sm text-base-content/50 font-normal">pwright@yahoo.com</p>
</div>
</div>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180"></span>
</button>
<div id="payment-arrow-right-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Richard Payne is a remarkable individual known for his exceptional skills and expertise in various fields. With a strong background in technology and a passion for innovation, Richard has made significant contributions to the industry.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="delivery-arrow-right-collapse" aria-expanded="false">
<div class="flex gap-4">
<div class="avatar">
<div class="size-12 rounded-md">
<img src="https://cdn.flyonui.com/fy-assets/avatar/avatar-7.png" alt="avatar" />
</div>
</div>
<div>
<p class="mb-0.5">Jordan Stevenson</p>
<p class="text-sm text-base-content/50 font-normal">wramirez@outlook.com</p>
</div>
</div>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180"></span>
</button>
<div id="delivery-arrow-right-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Jordan Stevenson is a talented individual with a passion for technology and innovation. Jordan has made significant contributions to various projects and has a deep understanding of programming languages and frameworks.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="cancel-arrow-right-collapse" aria-expanded="false">
<div class="flex gap-4">
<div class="avatar">
<div class="size-12 rounded-md">
<img src="https://cdn.flyonui.com/fy-assets/avatar/avatar-8.png" alt="avatar" />
</div>
</div>
<div>
<p class="mb-0.5">Nicholas Tanner</p>
<p class="text-sm text-base-content/50 font-normal">snguyen@icloud.com</p>
</div>
</div>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180"></span>
</button>
<div id="cancel-arrow-right-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Nicholas Tanner is a highly skilled individual with a strong passion for technology and innovation. Nicholas has made significant contributions to numerous projects and possesses a deep understanding of various programming languages and frameworks.
</p>
</div>
</div>
</div>
</div>
A simple accordion setup with an arrow positioned on the right side.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="payment-arrow-right-collapse" aria-expanded="true">
When is payment taken for my order?
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="payment-arrow-right-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="delivery-arrow-right-collapse" aria-expanded="false">
How would you ship my order?
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="delivery-arrow-right-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-arrow-right">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="cancel-arrow-right-collapse" aria-expanded="false">
Can I cancel my order?
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 size-5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="cancel-arrow-right-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-arrow-right" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
An accordion featuring an icon on the left and an arrow on the right.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-icon">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="payment-icon-collapse" aria-expanded="true">
<span class="inline-flex items-center gap-x-4">
<span class="icon-[tabler--credit-card-pay] text-base-content size-6"></span>
When is payment taken for my order?
</span>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 text-base- size-4.5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="payment-icon-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-icon">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="delivery-icon-collapse" aria-expanded="false">
<span class="inline-flex items-center gap-x-4">
<span class="icon-[tabler--shopping-bag] text-base-content size-6"></span>
How would you ship my order?
</span>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 text-base- size-4.5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="delivery-icon-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-icon">
<button class="accordion-toggle inline-flex items-center justify-between text-start" aria-controls="cancel-icon-collapse" aria-expanded="false">
<span class="inline-flex items-center gap-x-4">
<span class="icon-[tabler--ban] text-base-content size-6"></span>
Can I cancel my order?
</span>
<span class="icon-[tabler--chevron-left] accordion-item-active:-rotate-90 text-base- size-4.5 shrink-0 transition-transform duration-300 rtl:-rotate-180" ></span>
</button>
<div id="cancel-icon-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
A version without an Plus.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion divide-neutral/20 max-w-lg divide-y">
<div class="accordion-item active" id="payment-no-icon">
<button class="accordion-toggle text-start" aria-controls="payment-no-icon-collapse" aria-expanded="true">
When is payment taken for my order?
</button>
<div id="payment-no-icon-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-no-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-no-icon">
<button class="accordion-toggle text-start" aria-controls="delivery-no-icon-collapse" aria-expanded="false">
How would you ship my order?
</button>
<div id="delivery-no-icon-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby=" delivery-no-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel-no-icon">
<button class="accordion-toggle text-start" aria-controls="cancel-no-icon-collapse" aria-expanded="false">
Can I cancel my order?
</button>
<div id="cancel-no-icon-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel-no-icon" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
A basic form of the bordered accordion. Use the accordion-bordered
class to add a border to the accordion.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
For large products, we deliver your product via a third party logistics company offering you the “room of choice” scheduled delivery service. For small products, we offer free parcel delivery.
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
<div class="accordion accordion-bordered">
<div class="accordion-item active" id="payment-bordered">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="payment-bordered-collapse" aria-expanded="true">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-bordered-collapse" class="accordion-content w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-bordered" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="delivery-bordered">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="delivery-bordered-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
How would you ship my order?
</button>
<div id="delivery-bordered-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="delivery-bordered" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
For large products, we deliver your product via a third party logistics company offering you the “room of
choice” scheduled delivery service. For small products, we offer free parcel delivery.
</p>
</div>
</div>
</div>
<div class="accordion-item" id="cancel̉-bordered">
<button class="accordion-toggle inline-flex items-center gap-x-4 px-5 py-4 text-start" aria-controls="cancel̉-bordered-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
Can I cancel my order?
</button>
<div id="cancel̉-bordered-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="cancel̉-bordered" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Scheduled delivery orders can be cancelled 72 hours prior to your selected delivery date for full refund.
</p>
</div>
</div>
</div>
</div>
PARAMETERS | DESCRIPTION | OPTIONS | DEFAULT VALUE |
---|---|---|---|
data-accordion-always-open | Makes accordion items stay open when another item is opened. | boolean | false |
The HSAccordion
object is contained within the global window
object.
METHOD | DESCRIPTION |
---|---|
PUBLIC METHODS | |
show() | Open collapsed item. |
hide() | Collapse item. |
STATIC METHODS | |
HSAccordion.getInstance(target, isInstance) | Returns the element associated to the target .
|
HSAccordion.show(target) | Open collapsed item.
|
HSAccordion.hide(target) | Collapse item.
|
Below, we demonstrate how to use the public methods. Assign an ID to the accordion-item
as shown. To test the other methods, copy the provided code into your console and click the button.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
<div class="accordion max-w-lg">
<div class="accordion-item –prevent-on-load-init" id="payment-method">
<button id="payment-btn" class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-method-collapse" aria-expanded="false">
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-method-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-method" role="region">
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
</div>
<div>
<button class="btn btn-primary w-auto" id="show-btn">Show</button>
<button class="btn btn-primary w-auto" id="hide-btn">Hide</button>
</div>
<script>
window.addEventListener('load', function () {
const accordion = new HSAccordion(document.querySelector('#payment-method'))
const accordionBtn = document.querySelector('#payment-btn')
const showBtn = document.querySelector('#show-btn')
const hideBtn = document.querySelector('#hide-btn')
showBtn.addEventListener('click', () => {
accordion.show()
accordionBtn.addEventListener('click', () => {
accordion.hide()
})
})
hideBtn.addEventListener('click', () => {
accordion.hide()
})
})
</script>
Open item (public method).
// This method is used in above example.
const accordion = new HSAccordion(document.querySelector('#payment-method'));
const showBtn = document.querySelector('#show-btn');
showBtn.addEventListener('click', () => {
accordion.show();
});
Open item (static method).
const showBtn = document.querySelector('#show-btn');
showBtn.addEventListener('click', () => {
HSAccordion.show('#payment-method');
});
Open item (mixed).
const { element } = HSAccordion.getInstance('#payment-method', true);
const showBtn = document.querySelector('#show-btn');
showBtn.addEventListener('click', () => {
element.show();
});
METHOD | DESCRIPTION | RETURNING VALUE |
---|---|---|
on:open | Fires after the accordion is opened. | Current accordion element. |
on:close | Fires after accordion is closed. | Current accordion element. |
Just like in the methods section, assign an ID to the accordion-item
in events. Click on the accordion, and observe the console
output.
Payment is taken during the checkout process when you pay for your order. The order number that appears on the confirmation screen indicates payment has been successfully processed.
<div class="accordion max-w-lg">
<div class="accordion-item" id="payment-event">
<button id="payment-btn" class="accordion-toggle inline-flex items-center gap-x-4 text-start" aria-controls="payment-event-collapse" >
<span class="icon-[tabler--plus] accordion-item-active:hidden text-base-content size-4.5 block shrink-0"></span>
<span class="icon-[tabler--minus] accordion-item-active:block text-base-content size-4.5 hidden shrink-0"></span>
When is payment taken for my order?
</button>
<div id="payment-event-collapse" class="accordion-content hidden w-full overflow-hidden transition-[height] duration-300" aria-labelledby="payment-event" >
<div class="px-5 pb-4">
<p class="text-base-content/80 font-normal">
Payment is taken during the checkout process when you pay for your order. The order number that appears on the
confirmation screen indicates payment has been successfully processed.
</p>
</div>
</div>
</div>
</div>
<script>
window.addEventListener('load', function () {
const { element } = HSAccordion.getInstance('#payment-event', true)
element.on('open', instance => {
console.log('open')
})
element.on('close', instance => {
console.log('close')
})
})
</script>
Open any accordion event example.
const { element } = HSAccordion.getInstance('#payment-event', true)
element.on('open', (instance) => {console.log("open")});
element.on('close', (instance) => {console.log("close")});