A Ruby gem that packages the stimulus-components collection of 34+ Stimulus controllers for easy integration with Rails applications.
- Rails 7.1+
- Ruby 3.1+
Add this line to your application's Gemfile:
gem "stimulus-components"Then run:
bundle installAdd to your config/importmap.rb:
pin "stimulus-components", to: "stimulus-components.js"
pin "@hotwired/stimulus", to: "https://cdn.jsdelivr.net/gh/hotwired/stimulus@3.2.2/dist/stimulus.umd.js"
pin "@hotwired/stimulus-loading", to: "https://cdn.jsdelivr.net/gh/hotwired/stimulus-loading@1.0.5/dist/stimulus-loading.umd.js"
pin "stimulus-use", to: "https://cdn.jsdelivr.net/npm/stimulus-use@1.0.0/dist/index.js"Add to your app/assets/javascripts/application.js:
//= require stimulus-componentsIn your JavaScript entry point (e.g., app/javascript/controllers/index.js):
import { application } from "stimulus-components"
window.Stimulus = applicationOr import individual controllers:
import ClipboardController from "stimulus-components/clipboard"
import PasswordVisibilityController from "stimulus-components/password-visibility"| Controller | Description |
|---|---|
animated-number |
Animates numbers on scroll |
auto-submit |
Auto-submits forms with debounce |
carousel |
Swiper-based carousel |
character-counter |
Counts characters in inputs |
chartjs |
Chart.js integration |
checkbox-select-all |
Select all checkbox functionality |
clipboard |
Copy to clipboard |
color-picker |
Color picker with Pickr |
confirmation |
Form confirmation checks |
content-loader |
Load remote content |
dialog |
Native dialog element |
dropdown |
Dropdown with transitions |
glow |
Hover glow effect |
hotkey |
Keyboard shortcuts |
lightbox |
Image lightbox gallery |
notification |
Toast notifications |
password-visibility |
Toggle password visibility |
places-autocomplete |
Google Places autocomplete |
popover |
Popover content display |
prefetch |
Link prefetching |
rails-nested-form |
Nested form management |
read-more |
Expandable content |
remote-rails |
Remote response handling |
reveal |
Toggle element visibility |
scroll-progress |
Scroll progress bar |
scroll-reveal |
Scroll-based animations |
scroll-to |
Smooth scroll to element |
sortable |
Sortable lists |
sound |
Audio playback |
speech-recognition |
Voice input |
textarea-autogrow |
Auto-growing textarea |
timeago |
Relative timestamps |
Some controllers require external libraries. Add these to your package.json or via CDN:
{
"dependencies": {
"@hotwired/stimulus": "^3.2",
"@rails/request.js": "^0.0.8",
"chart.js": "^4.0",
"lightgallery": "^2.0",
"sortablejs": "^1.15",
"stimulus-use": "^1.0",
"swiper": "^11.0",
"@simonwep/pickr": "^1.9",
"date-fns": "^3.0"
}
}For detailed usage instructions, see the official documentation.
MIT License - see LICENSE.txt
- Fork it
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request