I would like to use Bootstrap 5 with LWC.
I add in the index.html :
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
I add in the index.js
import '@lwc/synthetic-shadow';
I start my project with : https://github.com/muenzpraeger/create-lwc-app
I tried to load the accordion : https://getbootstrap.com/docs/5.0/components/accordion/
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Accordion Item #1
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
</div>
The CSS works well every where.
When the code is in the index.html, on the click on the accordion the javascript is executed and the area expand.
But when the same code is inside a component, nested between template tag's, nothing happen, it's like the javascript is not executed.
The problem is probably because of the Shadow Dom.
I need help, because i don't find any information.
How to load the javascript of Bootstrap from a module/component LWC Open Source ?
I tried : https://rfcs.lwc.dev/rfcs/lwc/0113-virtual-script-container but didn't worked.
Regards, Thomas