0

I have implemented web component using LIT Element and integrated bootstrap5 in it. when I try to call modal/popovers/tooltip etc... it is not working.

render(){
  <!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
}

when I click on button it is not responding. Can any one help me how to enable the JavaScript functionality in LIT Element.

Thanks in Advance :)

1
  • Could you create a real example with an actual element?
    – Christian
    Commented Mar 16, 2023 at 7:53

1 Answer 1

1

I am not an expert in Bootstrap but i think that Bootstrap‘s Javascript is not able to find the elements which are normally found by using data attributes. I would expect that you have to init the plug-ins by calling the bootstrap javascript directly and pass the dom element or not to use shadowRoot inside your components.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.