Announcing Stimulus 2.0

Today we’re very excited to announce the release of Stimulus 2.0.

This version introduces two new APIs, values and CSS classes, which replace the data map API from Stimulus 1.0. You can read more about these APIs in the reference documentation:

We’ve also updated the Handbook to cover the changes in 2.0.

Here’s the full changelog for this release:

  • NEW: Values and CSS classes APIs (#202)
  • NEW: Support for DOM event listener options (#232)
  • CHANGED: Target attributes are now scoped by identifier (2235047)
  • CHANGED: Default event for text inputs from change to input (14ba2ab, #248)
  • FIXED: Invoking actions for events dispatched during connect (6129975, #222)
  • FIXED: Error using SVG elements in IE 11 (aa76e25, #274)
  • FIXED: Nested global action binding (2b6facc, #307)

If you’re upgrading from a previous version of Stimulus, note that the syntax for target attributes has changed to move the controller identifier into the attribute’s name. The new format is data-[identifier]-target="[name]" instead of data-target="[identifier].[name]". You can still use the old syntax, but you will see a warning in the console, and support will be removed in a future version.

The data map API from Stimulus 1.0 will continue to work but is no longer documented and should be considered internal. We suggest migrating to the new values API.

Thank you to everyone who tested and gave feedback on the changes in this release. It’s been a long time coming!

36 Likes

Awesome! A sincere thank you to @sam and @javan and everyone else that has contributed to Stimulus! I’ve been using it commercially for the past year and a half and it is such a joy to work with.

And a big thank you for the slow, deliberate evolution that is in stark contrast to most of the front-end world these days :smile:

7 Likes

I just wanted to second @welearnednothing - stimulus is just the right amount of JS for most of my projects. Thanks for such a well thought out project.

2 Likes

Hi @sam hope ur doin well! :relaxed: this is lookin great. <3 I’m excited to try this out.

2 Likes

So happy to see Stimulus doing this well. Thanks a lot for getting this together.

2 Likes

Just wanted to drop a sincere thanks for all the work you did on this! It really is appreciated <3

2 Likes

Very happy that oninput is now the default instead of onchange for inputs and textareas.

Stimulus rocks!

1 Like

Thank you both for this release!

1 Like

Happy to see the 2.0 release!

1 Like

congrats ! one of the best kept secrets in pragmatic web development, as lean and mean as you can get it :slight_smile:

2 Likes