How to create a dropdown menu with AlpineJS + TailwindCSS

AlpineJS is great as a jQuery replacement when you need to perform some simple Javascript operation like opening and closing a dropdown menu. Dropdown menu is now increasingly popular as a UI choice and here we’ll learn how to create the menu easily with AlpineJS and TailwindCSS.

Step 1. Include all necessary assets on our page

We’ll need both AlpineJS and TailwindCSS. For simplicity, we can pull them from the cloud directly: