Stimulus Quick Reference

Check out some quick references regarding Stimulus.

We'll cover the following...

Stimulus is small, but the conventions need to be hit exactly for it to work. Therefore, a quick reference table helps a lot. The basics of Stimulus can fit in the simple table that follows, with the naming conventions mimicking the expected case of the value.

Basics of Stimulus

Item

Attribute

Naming Convention

Controller

data-controller

controller-name

Action

data-action

event->controller-name#methodName

Target

data-controller-name-target

targetName

Value

data-controller-name-attribute-name-value

value

Class

data-controller-name-description-class

value

Some notes on semantics:

  • A controller declared as controller-name assumes the existence of a file app/packs/controller/controller_name_contro
...