A Rails gem that provides a simple helper method to generate HTML5 <details> collapsible sections with consistent styling and structure.
Add to Gemfile:
gem 'collapsible_section', '~> 0.1.3'
After building and installing the gem, replace your selected code with:
= collapsible_section(t('your_text'), open: true) do
= render('some_section_for_block', some_variable_for_block: current_variable)This will generate the same HTML structure but through a reusable gem component:
%details.section-collapsable{open: true}
%summary.section-header
%h3.section-title
= your_title
= your_blockInstall the gem and add to the application's Gemfile by executing:
bundle add collapsible_sectionIf bundler is not being used to manage dependencies, install the gem by executing:
gem install collapsible_sectiongem build collapsible_section.gemspec
gem push collapsible_section-0.1.3.gemBug reports and pull requests are welcome on GitHub at https://github.com/yaroslavrick/collapsible_section. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the CollapsibleSection project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.