Stimulus toggle controller
Installation
- Add package
yarn add stimulus-toggle
- Import package in your application
import { Application } from 'stimulus'
const application = Application.start()
import ToggleController from 'stimulus-toggle'
application.register('toggle', ToggleController)
Configuration
<div data-controller="toggle"
data-toggle-hidden-class="hidden"> <!-- optional -->
.hidden { display: none; }
Example
<div data-controller="toggle">
<button data-action="click->toggle#toggle">Toggle</button>
<div data-toggle-target="toggleable">
This should be toggled on click.
</div>
</div>
Publish new version
- Run
yarn build
- Update
CHANGELOG.md
- Run
yarn publish