STL Viewer Custom HTML Element

23 May 2021

About a 1-minute read

I made this little STL viewer to show off the 3D models I have been making to print. Click and drag to change the view!

The model shown here is a plastic bracket to hold an LED bar in a greenhouse cabinet.

It’s implemented as an HTML custom element. I haven’t used them before and it was pretty simple to make, and I think the best part is how streamlined it is to use:

<stl-viewer model="/stl-viewer/example.stl"></stl-viewer>

The custom element spec lets you add your own attributes to the elements, like model in this example. I found this article helpful in showing practical examples.

Find it on GitHub here!

Comments