All threads / Tabs with Stimulus

Ask A Question

Notifications

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: https://github.com/excid3/tailwindcss-stimulus-components

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.

example:

<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?' } %>
      </tr>
    <% end %>
    </div>

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 41,443+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.