Stimulus components
Getting started
This library is a set of multiple Stimulus controllers.
Installation
This library supports tree-shaking so you can import only the controllers you need.
$ yarn add stimulus-components
And use it in your JS file:
import { Application } from "stimulus"
import { Reveal } from "stimulus-components"
const application = Application.start()
application.register("reveal", Reveal)
Basic Usage
See Demo.
Documentation is available as README in controllers folders.
Extending Components
You can use inheritance to extend the functionality of any Stimulus components.
import { Reveal } from "stimulus-components"
export default class extends Reveal {
connect() {
super.connect()
console.log("Do what you cant here.")
}
}
These controllers will automatically have access to targets defined in the parent class.
If you override the connect, disconnect or any other methods from the parent, you'll want to call super.method()
to make sure the parent functionality is executed.
Development
Project setup
$ yarn install
$ yarn dev
Tests
Jest and Puppeteer are responsible to test this component:
$ yarn test
Linter
Prettier and ESLint are responsible to lint and format this component:
$ yarn lint
$ yarn format
Contributing
Do not hesitate to contribute to the project by adapting or adding features ! Bug reports or pull requests are welcome.
License
This project is released under the MIT license.