JS library is not working within a static component

This is my code drawing an arrow between the blue divs with LeaderLine library: Edit fiddle - JSFiddle - Code Playground

Screenshot 2022-01-19 192521

And this code is not working as html component:

import streamlit.components.v1 as components

components.html('''
    <div style="display: flex;">
        <div class="css-181e6i2 edgvbvh1" id="28" style="height: 30px; width: 30px; margin: 5px; background-color: blue;"></div>
        <div class="css-181e6i2 edgvbvh1" id="47" style="height: 30px; width: 30px; margin: 5px; background-color: yellow;"></div>
        <div class="css-181e6i2 edgvbvh1" id="113" style="height: 30px; width: 30px; margin: 5px; background-color: yellow;"></div>
        <div class="css-181e6i2 edgvbvh1" id="563" style="height: 30px; width: 30px; margin: 5px; background-color: yellow;"></div>
        <div class="css-181e6i2 edgvbvh1" id="453" style="height: 30px; width: 30px; margin: 5px; background-color: yellow;"></div>
        <div class="css-181e6i2 edgvbvh1" id="3" style="height: 30px; width: 30px; margin: 5px; background-color: blue;"></div>
    </div>
    <script src="https://files.cnblogs.com/files/mggahui/leader-line.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        var myLine = new LeaderLine(
            document.getElementById('28'),
            document.getElementById('3')
        )
    </script>
    ''',
    height=150, 
    scrolling=True
)

What do I do wrong?

Screenshot 2022-01-19 183330

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.