Lots of small controllers for small functionality

I’m really enjoying the combination of Turbolinks and Stimulus. It cleans up a lot of code, but I’m not sure if I’m using controllers correctly for implementing some functionality.

For example, let’s say I’m using a library for tooltips, and would like anything with [data-tooltip] to be converted to a tooltip. In the past, I would listen for a Turbolinks load event and search for those elements and convert them to a tooltip.

With the new Stimulus functionality, I’m not sure what is the best way to accomplish this? What I’ve done is add a data-controller="tooltips" attribute instead of [data-tooltip] and then calling this.element.tooltip(). However, my gut is that seems overkill to me for such small functionality.

Is the intention that small controllers be used to accomplish this, even for such small functionality with no other interactions? This is what I’ve been doing so far, and it works well, but I’m wondering if I’m missing something.

Yes, that’s exactly right! :smile: