Foundation allow you create accordion container if you have long list of content and want to present them in a beautiful manner.
By default accordion keep the first item as active and shows its content. By clicking on this single item it does not close that item. It only closes that item if you click on another item. As per the foundation 6 documentation if you want to allow all items to be collapsible when user click on that accordion item title. You need to pass data-allowed-all-close=”true” to accordion container.
What if you have only single item in your accordion and want that accordion item to be collapsed by default on page load.
Let say you have Terms and Condition on your site and want to use accordion to collapse all the condition with single accordion item and on initial page load terms and condition section should be collapsed so it does not increase the page height and user may not need to scroll too much. User can expand terms and condition if he is interested to see.
This can be done by adding data-allowed-all-close=”true” to accordion container and removing is-active class from that single accordion item.
See the Pen Foundation – Accordion Component – All closed on load by mahesh sankhala (@msankhala) on CodePen.