shou2017.com
JP

Using Semantic UI Dropdowns in Rails

Sat Nov 17, 2018
Sat Aug 10, 2024

I was a bit confused about this, so here’s a note.

How to enable dropdowns in Semantic UI.

To enable dropdowns like this:

Using Semantic UI Dropdowns in Rails

Add the following to your application.js:

<!-- app/assets/javascript/application.js -->

$(function(){
    $('.ui.dropdown').dropdown();
})

If it doesn’t trigger because of Turbolinks, use this instead:

<!-- app/assets/javascript/application.js -->

$(document).on('turbolinks:load', function() {
    $('.ui.dropdown').dropdown();
});

That’s it!

See Also