Use our responsive Tailwind CSS dropdown menu, that can take the user anywhere on your web app!
Our dropdown menu displays a list of choices on temporary surfaces. It appears when users interact with a button, action, or other control. When a user clicks/hovers over the parent element, the dropdown menu appears, presenting a vertically stacked list of actions.
See below our dropdown menu examples that you can use in your Tailwind CSS project. The example comes in different colors and styles, so you can adapt them easily to your needs.
To create a menu you can use the data-popover-target="
and {menuName}
"data-popover="
data attributes.{menuName}
"
This example showcases a simple and responsive dropdown menu component that includes a button to open the menu and a list (<ul>
) that represents the menu itself.
Use this component example if you want to implement a nested dropdown menu structure. You can do this by adding a data-popover-target="nested-menu"
attribute on one of the menu items, so that selecting this item will open another menu adjacent to the current one.
You can create nested/multi-level menus by setting the data-popover-nested="true"
data attribute to the menu trigger element.
In the example below, the component consists of a notification button that, when clicked, reveals a dropdown menu containing individual notification items. Each notification item includes an image and text, providing a more engaging and informative user experience.
Use this profile dropdown menu component that is triggered by an image acting as a button. When clicked, it reveals a dropdown menu with various options like "My Profile," "Edit Profile," "Inbox," "Help," and "Sign Out." The dropdown menu provides a centralized location for users to access various aspects of their profile and settings, improving the site's navigational efficiency.
The trigger element of the dropdown menu uses the popover trigger data attribute to work.
The menu element uses the popover data attributes to work.
The dropdown menu component needs the popover script to works, you just need to add the below script file to the bottom of your html file.
<!-- from node_modules -->
<script
type="module"
src="node_modules/@material-tailwind/html@latest/scripts/popover.js"
></script>
<!-- from cdn -->
<script
type="module"
src="https://unpkg.com/@material-tailwind/html@latest/scripts/popover.js"
></script>
Check out more dropdown examples from Material Tailwind Blocks.