stimulus-controllers
Installation
SKILL.md
Stimulus Controllers
Overview
Stimulus controllers provide modular JavaScript functionality connected to HTML via data attributes. After creating a new controller, you must register it in the index.js file.
Creating a New Controller
1. Create the Controller File
Create a new controller in app/javascript/controllers/:
// app/javascript/controllers/example_controller.js
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["element"]
static values = { name: String }