This is actually a very nice primer on how to build custom elements even if you don't use Rails.
FWIW you don't even need to define custom elements to use them: https://html3000.dev/
Great article, however using raw custom elements goes IMO against Rails' spirit, as it is way too low level, and requires lots of boilerplate to get working.
Stimulus is in the sweet spot for that. Both lean (as opposed to bloated), and not too low level, so that using it does not lead to verbose code. It is one of the very few JS frameworks that IMO do not contribute to JS proliferation, but actually work to reduce the amount of JS written.
[dead]
I appreciate how the author compares it to writing Stimulus components and it sounds like there's little real benefit for the day-to-day dev, unless you're doing something fancy and highly reusable in JS.