1. Overlays
  2. Dropdowns

Components

Tailwind CSS Dropdowns

A dropdown menu displays a list of actions and more with our JavaScript dropdown plugin.

Requires JS

Basic usage

Default

The default dropdown menu appearance.

Hover event

The default trigger mode is click, you can change it to hover.

Dividers

The default dropdown menu with dividers.

Icons

The default dropdown menu with icons.

Title

The default dropdown menu with title.

With header

The default dropdown menu with header.

Custom trigger

The default dropdown menu with custom trigger.

Custom icon trigger

The default dropdown menu with custom icon-trigger.

Animations

Slide up animation

The base dropdown menu with slide up animation.

Transform style

We are using Popperjs library for dropdown and tooltips 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.

Options

Auto close behavior

By default, the dropdown menu is closed when clicking inside or outside the dropdown menu. You can use the data-hs-dropdown-auto-close="inside | outside | false" option to change this behavior of the dropdown.

Make the dropdown item appear with checkbox.

Make the dropdown item appear with radio.

Directions

Use data-hs-dropdown-placement="bottom | bottom-left | bottom-right" to trigger dropdown menus above elements.

This example uses data-hs-dropdown-placement="bottom-right".

Dropup

Use data-hs-dropdown-placement="top | top-left | top-right" to trigger dropdown menus above elements.

This example uses data-hs-dropdown-placement="top-left".

Dropright

Use data-hs-dropdown-placement="right | right-top | right-bottom" to trigger dropdown menus at the right of the elements.

This example uses data-hs-dropdown-placement="right-top".

Dropleft

Use data-hs-dropdown-placement="left | left-top | left-bottom" to trigger dropdown menus at the left of the elements.

This example uses data-hs-dropdown-placement="top-left".

Responsive alignment

Control dropdown menu positions on the different breakpoints.

Resize the window to see it in action.