All threads / Tabs with Stimulus
Ask A Question


You’re not receiving notifications from this thread.

Tabs with Stimulus

Brian Gilbank asked in Javascript

Hi Chris - I've been following your guide on adding tabs with Stimulus here:

I am not using Tailwind but everything is working. However, when I add a block inside tab 1 nothing is rendered? The h2 content is rendered though.

There are no errors, so I am scratching my head.


<div class="hidden dbroot__content--1" data-target="tabs.panel">
    <h2>This is tab 1</h2>
    <div class="whatever">
    <% @pages.each do |page| %>
         <%= page.title %>
         <%= page.slug %>
         <%= link_to 'Show', page %>
         <%= link_to 'Edit', edit_dashboard_page_path(page) %>
         <%= link_to 'Destroy', page, method: :delete, data: { confirm: 'Are you sure?' } %>
    <% end %>

Oh never mind I am dumb. Figured it out.

Hey Brian!

Looks like you've got some invalid HTML there. There's a closing tablerow tr tag, but no opening one and you're missing a closing div for the tabs.panel div?

Thanks for the quick response, Chris. I switched computers and forgot that I didn't have any pages created on my desktop database. Embarrassing mistake lol.

Haha! I don't want to admit, but I do that pretty regularly too switching between my laptop and desktop. 😅

(And hilarious accidentally just commented from my laptop, logged into a testing account).

Ok Chris I just joined here and this package makes it worth it. A smooth dropdown menu. Great job and thanks.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 66,029+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.