kliping.pro
  • Docs
  • Explore
  • Builder
  • Directory
  • Colors
  • Typeset
Saved
Docs
  • Sections13
  • Installation5
  • Dark Mode4
  • Forms3
  • Registry6
  • Utilities2
  • More10
  • Components137
  • Accordion
  • Action Bar
  • AI Chat
  • AI Thread List
  • Alert
  • Alert Dialog
  • Angle Slider
  • Animated Grid Pattern
  • Aspect Ratio
  • Attachment
  • Avatar
  • Avatar Group
  • Badge
  • Badge Overflow
  • Banner
  • Border Beam
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Checkbox Group
  • Chip
  • Circular Progress
  • Client Only
  • Collapsible
  • Color Picker
  • Color Swatch
  • Combobox
  • Combobox Advanced
  • Command
  • Compare Slider
  • Composition
  • Context Menu
  • Cropper
  • Data Grid
  • Data Table
  • Data Table Advanced
  • Date Picker
  • Dialog
  • Direction Provider
  • Dot Pattern
  • Drawer
  • Dropdown Menu
  • Editable
  • Empty
  • Field
  • File Upload
  • Form
  • FPS
  • Gauge
  • Hitbox
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Kbd Advanced
  • Key Value
  • Label
  • List
  • Listbox
  • Logos
  • Map
  • Marker
  • Marquee
  • Mask Input
  • Masonry
  • Media Player
  • Mention
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Particles
  • Pending
  • Phone Input
  • Pin Input
  • Popover
  • Portal
  • Presence
  • Progress
  • QR Code
  • Questionnaire
  • Radio Group
  • Range Calendar
  • Rating
  • Relative Time Card
  • Resizable
  • Responsive Dialog
  • Scroll Area
  • Scroll Spy
  • Scroller
  • Segmented Input
  • Select
  • Selection Toolbar
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Software Purchase Card
  • Sonner
  • Sortable
  • Speed Dial
  • Spinner
  • Stack
  • Stat
  • Status
  • Stepper
  • Stepper Advanced
  • Swap
  • Switch
  • Table
  • Tabs
  • Tags Input
  • Tags Input Advanced
  • Textarea
  • Time Picker
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tour
  • Typography
  • Visually Hidden
  • Visually Hidden Input
  1. Docs
  2. Components
  3. Dropdown Menu

Dropdown Menu

PreviousNext

Menampilkan menu berisi aksi atau fungsi, dipicu lewat sebuah tombol.

View 8 variants
Docs API Reference

Installation ​

pnpm dlx kliping@latest add dropdown-menu

Pasang dependensi berikut:

pnpm add reka-ui

Salin dan tempel kode sumber di GitHub ke project Anda.

Sesuaikan path import dengan struktur project Anda.

Usage ​

vue
<script setup lang="ts">
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
</script>

<template>
  <DropdownMenu>
    <DropdownMenuTrigger>Open</DropdownMenuTrigger>
    <DropdownMenuContent>
      <DropdownMenuLabel>My Account</DropdownMenuLabel>
      <DropdownMenuSeparator />
      <DropdownMenuItem>Profile</DropdownMenuItem>
      <DropdownMenuItem>Billing</DropdownMenuItem>
      <DropdownMenuItem>Team</DropdownMenuItem>
      <DropdownMenuItem>Subscription</DropdownMenuItem>
    </DropdownMenuContent>
  </DropdownMenu>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Requirements ​

Semua dipasang otomatis oleh kliping add; tabel ini untuk Anda yang memasang manual atau memeriksa project.

RequirementValue
ProjectVue 3.5+, Tailwind CSS v4, alias @ — disiapkan kliping init
npm packages@lucide/vue@^1.31.0, @vueuse/core@^14.4.0, reka-ui@^2.10.3
Filescomponents/ui/dropdown-menu/dropdown-menu.vue
components/ui/dropdown-menu/dropdown-menu-checkbox-item.vue
components/ui/dropdown-menu/dropdown-menu-content.vue
components/ui/dropdown-menu/dropdown-menu-group.vue
components/ui/dropdown-menu/dropdown-menu-item.vue
components/ui/dropdown-menu/dropdown-menu-label.vue
components/ui/dropdown-menu/dropdown-menu-radio-group.vue
components/ui/dropdown-menu/dropdown-menu-radio-item.vue
components/ui/dropdown-menu/dropdown-menu-separator.vue
components/ui/dropdown-menu/dropdown-menu-shortcut.vue
components/ui/dropdown-menu/dropdown-menu-sub.vue
components/ui/dropdown-menu/dropdown-menu-sub-content.vue
components/ui/dropdown-menu/dropdown-menu-sub-trigger.vue
components/ui/dropdown-menu/dropdown-menu-trigger.vue
components/ui/dropdown-menu/index.ts

Anatomy ​

Susunan bagiannya seperti dipakai di contoh-contoh di atas. Impor semua bagian dari satu tempat, lalu susun begini:

vue
<DropdownMenu>
  <DropdownMenuTrigger />
  <DropdownMenuContent>
    <DropdownMenuItem>
      <DropdownMenuShortcut />
    </DropdownMenuItem>
    <DropdownMenuGroup>
      <DropdownMenuItem>
        <DropdownMenuShortcut />
      </DropdownMenuItem>
      <DropdownMenuSub>
        <DropdownMenuSubTrigger />
        <DropdownMenuSubContent>
          <DropdownMenuRadioGroup>
            <DropdownMenuRadioItem />
          </DropdownMenuRadioGroup>
          <DropdownMenuItem />
          <DropdownMenuSeparator />
        </DropdownMenuSubContent>
      </DropdownMenuSub>
    </DropdownMenuGroup>
    <DropdownMenuSeparator />
    <DropdownMenuLabel />
    <DropdownMenuCheckboxItem />
  </DropdownMenuContent>
</DropdownMenu>

API Reference ​

DropdownMenu ​

PropTypeDefaultDescription
defaultOpen?boolean—The open state of the dropdown menu when it is initially rendered. Use when you do not need to control its open state.
open?boolean—The controlled open state of the menu. Can be used as v-model:open.
dir?Direction$4—The reading direction of the combobox when applicable. If omitted, inherits globally from ConfigProvider or assumes LTR (left-to-right) reading mode.
modal?boolean—The modality of the dropdown menu. When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.
EventPayloadDescription
@update:open[payload: boolean]Emitted when the open state changes.
SlotProps
#default{ open: boolean; }
Data attributeValue
[data-slot]"dropdown-menu"

DropdownMenuCheckboxItem ​

PropTypeDefaultDescription
modelValue?CheckedState—The controlled checked state of the item. Can be used as v-model.
disabled?boolean—When true, prevents the user from interacting with the item.
textValue?string—Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item.
Use this when the content is complex, or you have non-textual content inside.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
EventPayloadDescription
@update:modelValue[payload: boolean]Emitted when the value changes.
@select[event: Event]Emitted when it is selected, by pointer or keyboard; call event.preventDefault() to keep the menu open.
SlotProps
#indicator-icon—
#default—
Data attributeValue
[data-slot]"dropdown-menu-checkbox-item"

DropdownMenuContent ​

PropTypeDefaultDescription
forceMount?boolean—Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
align?"start" | "end" | "center"—The preferred alignment against the trigger. May change when collisions occur.
side?"bottom" | "top" | "right" | "left"—The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
loop?boolean—When true, keyboard navigation will loop from last item to first, and vice versa.
reference?ReferenceElement—The custom element or virtual element that will be set as the reference to position the floating element. If provided, it will replace the default anchor element.
memoDependencies?unknown[]—Reactive dependencies that should invalidate the memoized content subtree.
sideOffset?number4The distance in pixels from the trigger.
sideFlip?boolean—Flip to the opposite side when colliding with boundary.
alignOffset?number—An offset in pixels from the start or end alignment options.
alignFlip?boolean—Flip alignment when colliding with boundary. May only occur when prioritizePosition is true.
avoidCollisions?boolean—When true, overrides the side and align preferences to prevent collisions with boundary edges.
collisionBoundary?Element | (Element | null)[]—The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check.
collisionPadding?number | Partial<Record<"bottom" | "top" | "right" | "left", number>>—The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
arrowPadding?number—The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners.
hideShiftedArrow?boolean—When true, hides the arrow when it cannot be centered to the reference element.
sticky?"partial" | "always"—The sticky behavior on the align axis. partial will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless.
hideWhenDetached?boolean—Whether to hide the content when the trigger becomes fully occluded.
positionStrategy?"fixed" | "absolute"—The type of CSS position property to use.
updatePositionStrategy?"always" | "optimized"—Strategy to update the position of the floating element on every animation frame.
disableUpdateOnLayoutShift?boolean—Whether to disable the update position for the content when the layout shifted.
prioritizePosition?boolean—Force content to be position within the viewport. Might overlap the reference element, which may not be desired.
EventPayloadDescription
@escapeKeyDown[event: KeyboardEvent]Emitted when Escape is pressed; call event.preventDefault() to keep it open.
@pointerDownOutside[event: PointerDownOutsideEvent]Emitted on a pointer down outside; call event.preventDefault() to keep it open.
@focusOutside[event: FocusOutsideEvent]Emitted when focus moves outside; call event.preventDefault() to keep it open.
@interactOutside[event: PointerDownOutsideEvent | FocusOutsideEvent]Emitted on any pointer down or focus outside; call event.preventDefault() to keep it open.
@closeAutoFocus[event: Event]Emitted when focus returns on close; call event.preventDefault() to stop it.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-content"

DropdownMenuGroup ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-group"

DropdownMenuItem ​

PropTypeDefaultDescription
disabled?boolean—When true, prevents the user from interacting with the item.
textValue?string—Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item.
Use this when the content is complex, or you have non-textual content inside.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
inset?boolean—Adds left padding so the item lines up with items that have an icon or indicator.
variant?"default" | "destructive""default"The visual style.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-item"
[data-inset]boolean
[data-variant]"default" | "destructive"

DropdownMenuLabel ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
inset?boolean—Adds left padding so the label lines up with items that have an icon or indicator.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-label"
[data-inset]boolean

DropdownMenuRadioGroup ​

PropTypeDefaultDescription
modelValue?AcceptableValue—The value of the selected item in the group.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
EventPayloadDescription
@update:modelValue[payload: AcceptableValue]Emitted when the value changes.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-radio-group"

DropdownMenuRadioItem ​

PropTypeDefaultDescription
valueAcceptableValue—The unique value of the item.
disabled?boolean—When true, prevents the user from interacting with the item.
textValue?string—Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item.
Use this when the content is complex, or you have non-textual content inside.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
EventPayloadDescription
@select[event: Event]Emitted when it is selected, by pointer or keyboard; call event.preventDefault() to keep the menu open.
SlotProps
#indicator-icon—
#default—
Data attributeValue
[data-slot]"dropdown-menu-radio-item"

DropdownMenuSeparator ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
Data attributeValue
[data-slot]"dropdown-menu-separator"

DropdownMenuShortcut ​

SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-shortcut"

DropdownMenuSub ​

PropTypeDefaultDescription
defaultOpen?boolean—The open state of the dropdown menu when it is initially rendered. Use when you do not need to control its open state.
open?boolean—The controlled open state of the menu. Can be used as v-model:open.
EventPayloadDescription
@update:open[payload: boolean]Emitted when the open state changes.
SlotProps
#default{ open: boolean; }
Data attributeValue
[data-slot]"dropdown-menu-sub"

DropdownMenuSubContent ​

PropTypeDefaultDescription
forceMount?boolean—Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
loop?boolean—When true, keyboard navigation will loop from last item to first, and vice versa.
reference?ReferenceElement—The custom element or virtual element that will be set as the reference to position the floating element. If provided, it will replace the default anchor element.
memoDependencies?unknown[]—Reactive dependencies that should invalidate the memoized content subtree.
sideOffset?number—The distance in pixels from the trigger.
sideFlip?boolean—Flip to the opposite side when colliding with boundary.
alignOffset?number—An offset in pixels from the start or end alignment options.
alignFlip?boolean—Flip alignment when colliding with boundary. May only occur when prioritizePosition is true.
avoidCollisions?boolean—When true, overrides the side and align preferences to prevent collisions with boundary edges.
collisionBoundary?Element | (Element | null)[]—The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check.
collisionPadding?number | Partial<Record<"bottom" | "top" | "right" | "left", number>>—The distance in pixels from the boundary edges where collision detection should occur. Accepts a number (same for all sides), or a partial padding object, for example: { top: 20, left: 20 }.
arrowPadding?number—The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners.
hideShiftedArrow?boolean—When true, hides the arrow when it cannot be centered to the reference element.
sticky?"partial" | "always"—The sticky behavior on the align axis. partial will keep the content in the boundary as long as the trigger is at least partially in the boundary whilst "always" will keep the content in the boundary regardless.
hideWhenDetached?boolean—Whether to hide the content when the trigger becomes fully occluded.
positionStrategy?"fixed" | "absolute"—The type of CSS position property to use.
updatePositionStrategy?"always" | "optimized"—Strategy to update the position of the floating element on every animation frame.
disableUpdateOnLayoutShift?boolean—Whether to disable the update position for the content when the layout shifted.
prioritizePosition?boolean—Force content to be position within the viewport. Might overlap the reference element, which may not be desired.
EventPayloadDescription
@escapeKeyDown[event: KeyboardEvent]Emitted when Escape is pressed; call event.preventDefault() to keep it open.
@pointerDownOutside[event: PointerDownOutsideEvent]Emitted on a pointer down outside; call event.preventDefault() to keep it open.
@focusOutside[event: FocusOutsideEvent]Emitted when focus moves outside; call event.preventDefault() to keep it open.
@interactOutside[event: PointerDownOutsideEvent | FocusOutsideEvent]Emitted on any pointer down or focus outside; call event.preventDefault() to keep it open.
@openAutoFocus[event: Event]Emitted when focus moves in on open; call event.preventDefault() to stop it.
@closeAutoFocus[event: Event]Emitted when focus returns on close; call event.preventDefault() to stop it.
@entryFocus[event: Event]Emitted when focus enters the group; call event.preventDefault() to skip focusing the first item.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-sub-content"

DropdownMenuSubTrigger ​

PropTypeDefaultDescription
disabled?boolean—When true, prevents the user from interacting with the item.
textValue?string—Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item.
Use this when the content is complex, or you have non-textual content inside.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
inset?boolean—Adds left padding so the trigger lines up with items that have an icon or indicator.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-sub-trigger"
[data-inset]boolean

DropdownMenuTrigger ​

PropTypeDefaultDescription
disabled?boolean—When true, prevents the user from interacting with item
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"dropdown-menu-trigger"

Keyboard Interactions ​

Perilaku keyboard-nya datang dari primitif Reka UI DropdownMenu yang dipakai komponen ini, mengikuti pola WAI-ARIA.

KeyDescription
SpaceWhen focus is on DropdownMenuTrigger, opens the dropdown menu and focuses the first item. When focus is on an item, activates the focused item.
EnterWhen focus is on DropdownMenuTrigger, opens the dropdown menu and focuses the first item. When focus is on an item, activates the focused item.
ArrowDownWhen focus is on DropdownMenuTrigger, opens the dropdown menu. When focus is on an item, moves focus to the next item.
ArrowUpWhen focus is on an item, moves focus to the previous item.
ArrowRight + ArrowLeftWhen focus is on DropdownMenuSubTrigger, opens or closes the submenu depending on reading direction.
EscCloses the dropdown menu and moves focus to{' '} DropdownMenuTrigger.

CSS Variables ​

Token tema yang dibaca komponen ini — ubah nilainya di CSS global (:root dan .dark, lihat Theming) untuk mengubah tampilannya tanpa menyentuh komponennya: --accent, --accent-foreground, --border, --destructive, --muted-foreground, --popover, --popover-foreground, --radius.

Credits ​

Berasal dari shadcn-vue (MIT, Copyright (c) 2023 unovue). Rantai lengkapnya di Credits.

PreviousDrawerNext Editable

On This Page

InstallationUsageRequirementsAnatomyAPI ReferenceDropdownMenuDropdownMenuCheckboxItemDropdownMenuContentDropdownMenuGroupDropdownMenuItemDropdownMenuLabelDropdownMenuRadioGroupDropdownMenuRadioItemDropdownMenuSeparatorDropdownMenuShortcutDropdownMenuSubDropdownMenuSubContentDropdownMenuSubTriggerDropdownMenuTriggerKeyboard InteractionsCSS VariablesCredits

© 2026 Kliping. Free components are open source under the MIT License.

LicenseCreditsRoadmap