The Dropdown Menu component introduces:
- <%= code("app/helpers/components/dropdown_menu_helper.rb") %>
- <%= code("app/views/components/ui/_dropdown_menu.html.erb") %>
- <%= code("app/javascript/controllers/ui/dropdown-menu_controller.js") %>
The method <%= code("render_dropdown_menu") %> defined in <%= code("app/helpers/components/dropdown_menu_helper.rb") %>
accepts a block for the two inner components, <%= code("dropdown_menu_trigger") %> and <%= code("dropdown_menu_content") %>. Each of those accepts a block for their respective content.
Within the <%= code("dropdown_menu_content") %> block, you can use the following methods:
- <%= code("dropdown_menu_label") %> - accepts an argument for the label section of the dropdown menu. This is optional.
- <%= code("dropdown_menu_item") %> - an arbitrary amount of these can be used for each menu item you want to include. This method either accepts a string or a block for the content you want.