Accordions in NEXT Design
Accordions in NEXT Design are built on bootstrap v5.3 using a numerical sequence. The first accordion will always default as accordionOne, with each subsequent accordion noted as its numerical value. The parent of each subsequent accordion will be noted as accordionOne, as they derive and will functionally 'drop down' using numerical sequence logic.
While there is no limit to the number of accordions an author can create - some agencies have used over twenty - please be mindful that accordions should be used diligently and when absolutely necessary. To create additional accordions, the noted accordion value needs to change for its numerical placement in the sequence. The numerical value needs to be explicitly written out as plain text, e.g accordionThirteen not accordion13.
To example, the below HTML code notes which values must change when populating additional accordions:
<div class="accordion" id="accordionOne">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">Accordion One</button></h2>
<div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordionAlpha">
<div class="accordion-body">This is example text</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">Accordion Two</button></h2>
<div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionOne">
<div class="accordion-body">This is sample text</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">Accordion Three</button></h2>
<div id="collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionOne">
<div class="accordion-body">This is sample text<br/></div>
</div>
</div>
</div>
Reusable Content
If accordion code is used on both a webpage and within reusable content to e.g populate a left navigation list, the numerical value sequencing will apply to both.
In this case, an example of numerical values not defined properly results in both accordionOne for the web page and in reusable content opening at the same time.
To prevent this, build out reusable content web parts first, and then populate accordions directly on the page. Thereafter, accordions built on the web page will carry off from the numerical sequence used in reusable content. Providing an example, if the last accordion used within reusable content ends with accordionThree, the first accordion on the web page must start as accordionFour, with each subsequent accordion deriving its value off of its parent, accordionFour.