MDN has your answer, built into the browser, ready to go:
https://developer.mozilla.org/docs/Web/API/Web_components
If that's not enough, Lit enhances it a bit such that either LitElement and/or litHtml can accommodate whichever style you want: https://lit.dev/