Dropdown
The Dropdown component is designed to present users with a neat and organized list of actions or additional content. Enabled by a JavaScript dropdown plugin, it ensures a smooth, collapsible interface for enhanced navigation and space efficiency.
Note that this component requires the use of the third-party Popper.js plugin, else you can skip this message if you are already using Preline UI as a package.
We are using Popperjs library for dropdown and tooltip and this library uses hardcoded styles like transform for menu positioning. In this situation we can use Tailwind translate classes for sub-container inside menu, also just add data-hs-transition
attribute for the sub-container.
By default, the dropdown menu is closed when clicking inside or outside the dropdown menu. You can use the --auto-close:inside
(outside | false) class to change this behavior of the dropdown.
Use [--placement:bottom | bottom-left | bottom-right]
class to trigger dropdown menus above elements.
This example uses [--placement:bottom-left]
class.
Use [--placement:top | top-left | top-right]
class to trigger dropdown menus above elements.
This example uses [--placement:top-left]
class.
Use [--placement:right | top-right | bottom-right]
class to trigger dropdown menus at the right of the elements.
This example uses [--placement:bottom-right]
class.
Use [--placement:left | top-left | bottom-left]
class to trigger dropdown menus at the left of the elements.
This example uses [--placement:bottom-left]
class.
Control dropdown menu positions on the different breakpoints.
Resize the window to see it in action.