tailwindlabs / tailwindui-issues

A place to report bugs discovered in Tailwind UI.
234 stars 4 forks source link

JS not Working after adding the play cdn #1548

Closed ali-se-ror closed 8 months ago

ali-se-ror commented 8 months ago

What component (if applicable)

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. added cdn
  2. copy pasted the nav from the examples
  3. dropdown under user just displays and click event on image does nothing

Expected behavior it should work without any problem by adding the cdn why the drop-downs are displaying by default

Screenshots image

Browser/Device (if applicable)

Additional context Add any other context about the problem here.

adamwathan commented 8 months ago

Hey! So when you are using the raw HTML examples, you need to write the necessary JavaScript yourself for any interactive stuff like opening and closing dropdowns/dialogs, or animating a toggle switch.

Here's a relevant documentation on using HTML with your own JS:

https://tailwindui.com/documentation#using-html-and-your-own-js

If you use React or Vue the examples will be totally interactive, but the HTML option is there specifically for folks who just want the markup and want to wire it up with whatever JS tooling makes sense for their project. With a Rails app that might be Stimulus for example, whereas in a Laravel app Alpine.js might be more popular, or maybe you just want to write it all totally by hand with vanilla JavaScript.

Sounds like this might not be what you expected when purchasing Tailwind UI so if this is a deal-breaker don't hesitate to reach out to support@tailwindui.com to resolve it — no hard feelings and sorry this caught you by surprise.