stimulus-snippets
Copy-pasteable Stimulus JS controllers for Ruby on Rails. Inspired by shadcn/ui — not an installable package, just files you own.
Components
Expand and collapse a set of content panels, with full ARIA disclosure support and optional single-open mode.
Character CountShow a live character count for a textarea or input, with optional remaining-characters feedback tied to a max length.
Checkbox RequiredRequire at least a minimum number of checkboxes in a group to be checked before the form can be submitted.
ClipboardCopy text from a source element to the clipboard on button click, with optional brief feedback.
DismissClick a button to remove or hide the controller element — alerts, flash notices, banners.
Password RevealToggle a password input between `password` (hidden) and `text` (visible) types, updating show/hide labels in sync.
Password RulesShow real-time feedback on whether a password satisfies a set of configurable rules. Each rule is a plain HTML element; the controller sets `data-valid="true"` or `data-valid="false"` on it as the user types. Your CSS handles the visual treatment.
SlugAuto-populate a URL slug field from a title or name field as the user types.
TabsShow one panel at a time from a set of tab buttons, with full ARIA tablist support and arrow-key navigation.