The project is in a healthy, maintained state
This gem provides a simple helper method to create collapsible sections in Rails views.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 7.0
 Project Readme

CollapsibleSection

A Rails gem that provides a simple helper method to generate HTML5 <details> collapsible sections with consistent styling and structure.

Usage in your project

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_block

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add collapsible_section

If bundler is not being used to manage dependencies, install the gem by executing:

gem install collapsible_section

Development

gem build collapsible_section.gemspec
gem push collapsible_section-0.1.3.gem

Contributing

Bug 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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the CollapsibleSection project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.