Dropdown 

Ripple UI comes with a dropdown component that can be used to display a list of options.

If you want to prevent to close the dropdown when click on item add tabIndex=-1

Default 

Simple example of a dropdown.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Bottom left and right 

Dropdowns can have different positions.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Top left and right 

Dropdown in top left and right.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-top-left">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-top-right">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Left and right 

Dropdown in left and right.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-left">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Left bottom and top 

Dropdown in left bottom and top.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-left-bottom">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-left-top">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Right bottom and top 

Dropdown in right bottom and top.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-right-bottom">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-right-top">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Opened 

Dropdown opened.

HTML
JSX
<div class="dropdown dropdown-open">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Hover 

Dropdown on hover.

HTML
JSX
<div class="dropdown dropdown-hover">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Divider 

Dropdown with divider.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right gap-1">
<a class="dropdown-item text-sm">Profile</a>
<div class="dropdown-divider" role="separator"></div>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

Bordered 

Dropdown with border.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right border border-gray-500">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm">Subscriptions</a>
</div>
</div>

With active item 

Dropdown with active item.

HTML
JSX
<div class="dropdown">
<label class="btn" tabindex="0">Options</label>
<div class="dropdown-menu dropdown-menu-bottom-right gap-1">
<a class="dropdown-item text-sm">Profile</a>
<a tabindex="-1" class="dropdown-item text-sm">Account settings</a>
<a tabindex="-1" class="dropdown-item text-sm dropdown-active">Subscriptions</a>
</div>
</div>

API 

classDescription
dropdown-containerDropdown container base class
dropdownDropdown base class
dropdown-menuDropdown menu base class
dropdown-hoverWill open the dropdown on hover
dropdown-openWill open the dropdown on load
dropdown-itemWill style a element as dropdown item
dropdown-activeWill style a element as active
dropdown-dividerWill apply a border separator
dropdown-menu-bottom-rightWill position to the bottom right
dropdown-menu-bottom-leftWill position to the bottom left
dropdown-menu-top-rightWill position to the top right
dropdown-menu-top-leftWill position to the top left
dropdown-menu-left-bottomWill position to the left bottom
dropdown-menu-left-topWill position to the left top
dropdown-menu-right-bottomWill position to the right bottom
dropdown-menu-right-topWill position to the right top
dropdown-menu-leftWill position to the left
dropdown-menu-rightWill position to the right
Edit this page on GitHub