shadcn.io is not affiliated with official shadcn/ui
Components
Free
Dropdown Menu for Vue
Open a list of commands from a button, for an account menu or the actions on a table row. For Vue with Ark UI, when those commands should stay hidden until asked.
Framework
UI library
A button opens a list of commands. One row can open a nested list when the first list would get too long.
Use it when the entries are actions, not a value the form stores. A menu that opens on right-click is a Context Menu and stays on the pointer. In Vue, Ark UI takes focus, typeahead, and Escape.
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
When focus is on trigger, opens or closes the submenu depending on reading direction.
Arrow Left
When focus is on trigger, opens or closes the submenu depending on reading direction.
EscEscape
Closes the menu and moves focus to the trigger.
Home
Go to the start.
End
Go to the end.
Demos
Basic
Profile, billing, and settings sit under a My Account label, then a separator, then GitHub, Support, and a disabled API row. Copy this when the menu is a short list of places plus one item that exists but cannot be used yet. The label is not a choice, so it stays out of the arrow-key sequence. Every other row should be a real destination or a real action.
Submenu
Invite users opens a second list, and that list opens a third for Calendly, Slack, and a webhook. Use a submenu when several actions share a parent and would make the first menu a scroll. Two levels is usually the limit. A third panel hides the item people just chose, and they have to find their way back with the arrow keys.
Shortcuts
Profile, billing, settings, and log out each end with a key hint, such as shift-command-P. DropdownMenuShortcut only prints that hint. It does not listen for the keys, so the binding has to live somewhere that still works while the menu is closed. Keep the hint short, and do not invent a shortcut you have not actually wired up.
Icons
A person, a card, and a gear sit in front of Profile, Billing, and Settings, and log out is marked destructive. The icon is a scanning aid, so hide it from assistive tech when the label already names the action. Skip the pictures if they do not add a second cue. Four familiar rows is about as many as this treatment can carry before it turns into decoration.
Checkboxes
Status bar starts checked, activity bar is disabled, and panel starts off, under an Appearance label. These are independent toggles, the sort of view preference you flip and then flip another without leaving the menu. Keep the checked values in state so the ticks survive the next open. If only one of the rows may be on, this is the wrong control and the radio group is the right one.
Checkboxes Icons
Email, SMS, and push, each with an icon, and more than one can be on at the same time. The pictures are doing real work here, because the three channels would otherwise be easy to mix up in a narrow menu. Email and push start on, SMS starts off. Same rule as the plain checkboxes: store the booleans yourself, and do not use this pattern for a single choice.
Radio Group
Panel position is top, bottom, or right, and only one of those can be selected. The tick remains the next time the menu opens, which is what you want for a setting and what a normal item will not remember. Hold the chosen string in state and pass it back in. Bottom starts selected so the menu is never a row of empty radios.
Radio Icons
Credit card, PayPal, and bank transfer, with one of them current. The icons are decorative and the words are the name, so do not rely on the picture alone. Start from a default, card here, because an empty radio group looks unfinished. A payment method is a setting the menu should remember, not an action that runs the moment it is clicked.
Destructive
Edit and share are ordinary rows. Delete sits after a separator with variant set to destructive, so the color warns before the click. That variant does not confirm anything. If the action cannot be undone, open an alert dialog and run the delete only from its confirm button, with the dangerous row last.
Avatar
The trigger is a round avatar, not a button that says Open. Account, billing, and notifications sit above a separator, then sign out. Use this when the menu belongs to a person and the photo is already how people find their account. The image alt is the name a screen reader gets from inside the button, so a meaningful alt matters more here than on a decorative avatar.
Complex
File, view, and account share one menu: shortcuts, nested recent projects, sidebar checkboxes, a theme choice, and a destructive sign out. Treat it as a stress test for groups and nested triggers, not a menu to ship. A list this long hides the item people came for. Split it, or move a stable set of menus into a Menubar when it is the app's main command surface.
Actions
An ellipsis on the Project Alpha row. Edit and Duplicate write the last action under the card, and Delete does not. It opens an alert dialog, and only the confirm button performs the delete. The line under the row is a live region, so the result is announced after the menu has closed and focus has moved on.
Rtl
Arabic labels run from the account submenu through view checkboxes, a position radio group, and logout. dir is rtl on the menu and on each nested panel, with the menu anchored to the end of the trigger. A page wrapper is not enough, because a submenu can still open the wrong way. Shortcuts stay at the end of the row, which here is the left side.
FAQ
How do I control whether a Dropdown Menu is open in Vue?
Keep the open flag in state and pass it back when it changes. Leave it uncontrolled when the menu should open and close on its own. Choosing an item closes it unless you opt out in the select handler.
Bind v-model:open, or listen to @open-change, which receives details.open.
How do I run code when a Dropdown Menu item is chosen?
The menu closes after a choice. Read which item it was in that handler, as the Actions demo does. A destructive action uses variant set to destructive and is still an ordinary menu item.
Listen to @select, which receives details.value. Each item needs a value.
How do I add a checkbox or radio choice to a Dropdown Menu?
Use a checkbox item when several options can be on together, and a radio group when only one can. Keep the checked value in state. The Checkboxes and Radio Group demos show both.
Checkbox items use checked and @checked-change. Bind a radio group with v-model. @value-change receives details.value.
How do I place a Dropdown Menu with Ark UI?
The menu moves to stay on screen, and it flips when there is not enough room. Set the preferred side, and set the width with a class on the popup. Nest a submenu with DropdownMenuSub, DropdownMenuSubTrigger, and DropdownMenuSubContent.
Pass positioning with placement, such as bottom-start, on Dropdown Menu.
Can I use a Dropdown Menu from the keyboard?
Yes. The Accessibility section lists the keys. Arrow Up and Arrow Down move the highlight, Enter and Space activate it, and Escape closes the menu and returns focus to the trigger. Arrow Left and Arrow Right open or close a submenu, following the reading direction. Disabled items are skipped. Typeahead jumps to a matching label.
Why is my Dropdown Menu clipped or behind a dialog?
The popup is portaled and uses z-50, so a parent with hidden overflow does not clip it. A dialog that also portals can still paint over the menu. Open the menu from inside that dialog rather than from the page behind it. Give an icon-only trigger an aria-label, as the Actions demo does.
Should I use a Dropdown Menu or a Context Menu?
Use a Dropdown Menu when a button or an avatar opens a list of actions. Use a Context Menu when the list opens from a right-click or a long press on a region. Use a Select when the choice is a form value that should stay visible in the closed control. A menu item is an action, not a submitted field.
How do I install Dropdown Menu in Vue?
Run the command in the Installation section above. It adds the menu, trigger, content, items, groups, and submenu parts to your ui folder. Buttons and icons are separate. The demos on this page use the same parts.
The command uses the shadcn-vue CLI.
API Reference
DropdownMenu
data-slot="menu"
PropType
open?boolean
The controlled open state of the menu. Two-way with v-model:open.
defaultOpen?boolean
The initial open state of the menu when rendered.
Use when you don't need to control the open state of the menu.
triggerValue?string | null
The controlled trigger value. Two-way with v-model:triggerValue.
Type
string | null
defaultTriggerValue?string | null
The initial trigger value when rendered.
Use when you don't need to control the trigger value.
Type
string | null
anchorPoint?Point | null
The positioning point for the menu. Can be set by the context menu trigger or the button trigger.
Type
Point | null
closeOnSelect?boolean
Whether to close the menu when an option is selected.
Default
true
composite?boolean
Whether the menu is a composed with other composite widgets like a combobox or tabs.
Default
true
defaultHighlightedValue?string | null
The initial highlighted value of the menu item when rendered.
Use when you don't need to control the highlighted value of the menu item.
Type
string | null
dir?"ltr" | "rtl"
The reading direction. Inherits the nearest DirectionProvider when unset.
Type
"ltr" | "rtl"
hideMode?"display-none" | "activity"
How to hide content when mounted but not present.
- display-none: HTML hidden attribute. Effects stay alive.
- activity: React 19 <Activity mode="hidden">. Effects pause. Requires React 19+.
Type
"display-none" | "activity"
Default
"display-none"
highlightedValue?string | null
The controlled highlighted value of the menu item.
Type
string | null
id?string
The unique identifier of the machine.
ids?object
The ids of the elements in the menu. Useful for composition.
Function called when the pointer is pressed down outside the component.
Type
(event: PointerDownOutsideEvent) → void
Parameters
event – PointerDownOutsideEvent
Returns
void
@request-dismiss(event: LayerDismissEvent) → void
Function called when this layer is closed due to a parent layer being closed.
Type
(event: LayerDismissEvent) → void
Parameters
event – LayerDismissEvent
Returns
void
@select(details: SelectionDetails) → void
Function called when a menu item is selected.
Type
(details: SelectionDetails) → void
Parameters
details – { value: string }
Returns
void
DropdownMenuArrow
<div>
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
CSS variableType
--arrow-backgroundstring
Use this variable to style the arrow background.
--arrow-offsetstring
The offset position of the arrow.
--arrow-sizestring
The size of the arrow.
--arrow-size-halfstring
Half the size of the arrow.
DropdownMenuSubContent
<div>data-slot="menu-sub-content"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AttributeType
data-has-nested?string
Present when another menu is nested inside it.
data-instant?string
data-nested?string
Present when it's nested inside another menu.
data-placementstring
The placement of the content.
data-side"top" | "right" | "bottom" | "left"
The side of the trigger that the content is positioned on.
Type
"top" | "right" | "bottom" | "left"
data-state"open" | "closed"
"open" or "closed".
Type
"open" | "closed"
CSS variableType
--available-heightstring
The height left between the anchor and the viewport's edge.
--layer-indexstring
The index of the dismissable in the layer stack.
--nested-layer-countstring
The number of nested menus.
--transform-originstring
Where the content scales from, on its trigger's side.
DropdownMenuQuickItem
<div>
PropType
valuestring
The unique value of the menu item option.
checked?boolean
Whether it's checked.
disabled?boolean
Whether the menu item is disabled.
valueText?string
The textual value of the option. Used in typeahead navigation of the menu. If not provided, the text content of the menu item will be used.
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
Default
"default"
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AttributeType
data-disabled?string
Present when disabled.
data-highlighted?string
Present when highlighted.
data-ownedbystring
Id of the content part.
data-valuestring
The value of the item.
data-valuetextstring
The human-readable value.
data-variant?string
Mirrors variant.
DropdownMenuGroup
<div>data-slot="menu-group"
PropType
heading?string
The heading of the menu item group.
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
DropdownMenuLabel
<div>data-slot="menu-group-label"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
DropdownMenuPositioner
<div>data-slot="menu-positioner"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AttributeType
data-has-nested?string
Present when the positioner has nested menus.
data-instant?string
data-nested?string
Present when the positioner is nested within another menu.
CSS variableType
--available-heightstring
The available height in viewport.
--available-widthstring
The available width in viewport.
--reference-heightstring
The height of the root.
--reference-widthstring
The width of the reference element.
--transform-originstring
The transform origin for animations.
--xstring
The x position for transform.
--ystring
The y position for transform.
--z-indexstring
The z-index value.
DropdownMenuSeparator
<hr>data-slot="menu-separator"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
DropdownMenuTrigger
<button>data-slot="menu-trigger"
PropType
value?string
The value that identifies this specific trigger.
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
AttributeType
data-controls?string
data-current?string
Present when current.
data-disabled?string
Present when disabled.
data-placement?string
The placement of the trigger.
data-side?string
The side of the trigger that the trigger is positioned on.
data-state"open" | "closed"
"open" or "closed".
Type
"open" | "closed"
data-value?string
The value of the item.
DropdownMenuSubTrigger
<div>data-slot="menu-sub-trigger"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
DropdownMenuContent
<div>data-slot="menu-content"
PropType
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AttributeType
data-has-nested?string
Present when another menu is nested inside it.
data-instant?string
data-nested?string
Present when it's nested inside another menu.
data-placementstring
The placement of the content.
data-side"top" | "right" | "bottom" | "left"
The side of the trigger that the content is positioned on.
Type
"top" | "right" | "bottom" | "left"
data-state"open" | "closed"
"open" or "closed".
Type
"open" | "closed"
CSS variableType
--available-heightstring
The height left between the anchor and the viewport's edge.
--layer-indexstring
The index of the dismissable in the layer stack.
--nested-layer-countstring
The number of nested menus.
--transform-originstring
Where the content scales from, on its trigger's side.
DropdownMenuItem
<div>
PropType
valuestring
The unique value of the menu item option.
checked?boolean
Whether it's checked.
disabled?boolean
Whether the menu item is disabled.
valueText?string
The textual value of the option. Used in typeahead navigation of the menu. If not provided, the text content of the menu item will be used.
variant?"default" | "destructive"
The visual style.
Type
"default" | "destructive"
Default
"default"
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
AttributeType
data-disabled?string
Present when disabled.
data-highlighted?string
Present when highlighted.
data-ownedbystring
Id of the content part.
data-valuestring
The value of the item.
data-valuetextstring
The human-readable value.
data-variant?string
Mirrors variant.
DropdownMenuCheckboxItem
<div>
PropType
valuestring
The value of the option.
closeOnSelect?boolean
Whether the menu should be closed when the option is selected.
disabled?boolean
Whether the menu item is disabled.
valueText?string
The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
DropdownMenuRadioGroup
<div>data-slot="menu-radio-group"
PropType
heading?string
The heading of the menu radio item group.
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
DropdownMenuRadioItem
<div>data-slot="menu-radio-item"
PropType
valuestring
The value of the option.
closeOnSelect?boolean
Whether the menu should be closed when the option is selected.
disabled?boolean
Whether the menu item is disabled.
valueText?string
The textual value of the option. Used in typeahead navigation of the menu.
If not provided, the text content of the menu item will be used.
asChild?boolean
Use the provided child element as the default rendered element, combining their props and behavior.
class?string
Merged with the part's classes.
DropdownMenuSub
data-slot="menu-sub"
PropType
open?boolean
The controlled open state of the menu. Two-way with v-model:open.
defaultOpen?boolean
The initial open state of the menu when rendered.
Use when you don't need to control the open state of the menu.
triggerValue?string | null
The controlled trigger value. Two-way with v-model:triggerValue.
Type
string | null
defaultTriggerValue?string | null
The initial trigger value when rendered.
Use when you don't need to control the trigger value.
Type
string | null
anchorPoint?Point | null
The positioning point for the menu. Can be set by the context menu trigger or the button trigger.
Type
Point | null
closeOnSelect?boolean
Whether to close the menu when an option is selected.
Default
true
composite?boolean
Whether the menu is a composed with other composite widgets like a combobox or tabs.
Default
true
defaultHighlightedValue?string | null
The initial highlighted value of the menu item when rendered.
Use when you don't need to control the highlighted value of the menu item.
Type
string | null
dir?"ltr" | "rtl"
The reading direction. Inherits the nearest DirectionProvider when unset.
Type
"ltr" | "rtl"
hideMode?"display-none" | "activity"
How to hide content when mounted but not present.
- display-none: HTML hidden attribute. Effects stay alive.
- activity: React 19 <Activity mode="hidden">. Effects pause. Requires React 19+.
Type
"display-none" | "activity"
Default
"display-none"
highlightedValue?string | null
The controlled highlighted value of the menu item.
Type
string | null
id?string
The unique identifier of the machine.
ids?object
The ids of the elements in the menu. Useful for composition.