Dropdowns

Dropdown menus are incredibly common in web applications, so of course they're a component in Instrumental Components.

A dropdown menu essentially consists of 3 parts:

  • The trigger: The element or icon that a user clicks or hovers over to open the dropdown
  • The dropdown menu: The container that appears when the trigger is activated
  • The dropdown items: The individual items (typically links) that appear in the dropdown menu

Instrumental dropdown menus can be a simple collection of links, or they can include icons for each link, and a wide range of other customization options.

Demos

Preview
Code

Installation

Copy
rails g instrumental:dropdowns

To insert a component into a view:

Copy
rails g instrumental:dropdowns:insert

To insert a link into a dropdown menu in a view:

Copy
rails g instrumental:dropdowns:link:insert

To insert a dropdown menu into a view:

Customization

Find all of your customization options (via local variables) in these files:

app/views/shared/components/dropdowns/_dropdown.html.erb
app/views/shared/components/dropdowns/_dropdown_link.html.erb

Instrumental Components

I created Instrumental Components to make designing and building professional apps with Ruby on Rails easy, fast, and fun. I use it on all of my projects and I hope it helps you build something great.

Brian Casel
Brian Casel
Creator of Instrumental Components
Learn more Send me a question or request