stimulus-shorthand
v0.1.1
Published
Function for configuring abbreviated html for instantiating simple stimulus controllers
Downloads
47
Readme
Stimulus Shorthand
Convention to make simple controllers less noisy in the template.
Usage
// app/javascripts/controllers/if_controller.js
shorthand({ controller: "if", value: "condition" })
export default class extends Controller {
static values = {
condition: String,
}
// ...
}
<div data-if="checkbox is checked">
<!-- equivalent to: -->
<div data-controller="if" data-if-condition-value="checkbox is checked">