Resources for creating JavaScript library that generates HTML Components?


I want to create a JavaScript library that can create HTML components through JavaScript method calls. Libraries like chart.js or sigma.js are good examples of the kind of library I desire to create.

Do libraries like chart.js and sigma.js implement their visual libraries with no prior blueprint, and not follow a “best practice” for similar libraries that generate HTML components? Or are there known optimal methods/structures to creating a JavaScript library that generates HTML?

If you know of any resources, would you mind sharing them? I was not able to find resources that discussed this specific question. One thing I could do is study these libraries. However, they are large libraries and I wanted to see if there were other resources I can checkout first. I predict my library will be much simpler in functionality and smaller in scale to libraries like chart.js and sigma.js.