A Little More Stimulus
Let's use Stimulus to build some more features!
We'll cover the following
Now that we’ve seen the basics of Stimulus, let’s build the toggle based on the calendar dates that we did in the Going Generic section, and while we’re here, let’s make the search field work, too. Both can be done with very short Stimulus controllers.
The planning in adding Stimulus features involves where to place the controller, the targets, and the actions. We’ll do this as two separate controllers: one for the calendar dates, and one for the text filter. Both of these controllers act on the entire page—there’s a filter in the header part, but the result is in the body of the page. The controller needs to encompass both parts, so it makes sense to declare both controllers in the section
tag that encompasses the whole page:
Get hands-on with 1400+ tech skills courses.