Dropdown Menu

A component for rendering dropdown menus that display a set of actions or options to users.

In this guide, you'll learn how to use the Dropdown Menu component.

Was this example helpful?

Usage#

Code
import { DropdownMenu } from "@medusajs/ui"
Code
1<DropdownMenu>2  <DropdownMenu.Trigger>Trigger</DropdownMenu.Trigger>3  <DropdownMenu.Content>4    <DropdownMenu.Item>Edit</DropdownMenu.Item>5    <DropdownMenu.Item>Add</DropdownMenu.Item>6    <DropdownMenu.Item>Delete</DropdownMenu.Item>7  </DropdownMenu.Content>8</DropdownMenu>

API Reference#

This component is based on the Radix UI Dropdown Menu primitive.

This component is based on the Radix UI Dropdown Menu Trigger primitive.

This component is based on the Radix UI Dropdown Menu Content primitive.

PropTypeDefault
sideOffset
8
collisionPadding
8
align
"center"
Was this helpful?

This component is based on the Radix UI Dropdown Menu Item primitive.

This component is based on the span element and supports all of its props

This component is based on the span element and supports all of its props

This component is based on the Radix UI Dropdown Menu RadioGroup primitive.

This component is based on the Radix UI Dropdown Menu RadioItem primitive.


Examples#

Sorting#

This example shows how to display collection sorting choices using a Dropdown Menu.

Sorting: none
Was this example helpful?
Was this example helpful?

Disabled Items and Using Icons#

Was this example helpful?

Keyboard Shortcuts (with handling)#

This example shows how to visually display keyboard shortcuts in the menu and handle them in your application logic.

You can use the E and D shortcuts to trigger the actions of the dropdown items.

Was this guide helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break