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>
Reply

Oh never mind I am dumb. Figured it out.

Reply

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?

Reply

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.

Reply

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

Reply

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

Reply

Hahah!

Reply

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

Reply
Join the discussion
Create an account Log in

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

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

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