Skip to content

Dropdown API Reference

Props

PropTypeDefaultDescription
itemsArray[]Array of items to display in the dropdown
modelValueArray/String/Number/Object[]Selected value(s) for v-model binding
itemTextString'text'Property name for item display text
itemValueString'value'Property name for item value
multipleBooleanfalseEnable multiple item selection
disabledBooleanfalseDisable the dropdown
buttonTextString'Select'Default button text when no item is selected
noDataTextString'No items available'Text displayed when no items are available
selectedOnTopBooleanfalseShow selected items at the top of the list
triggerTypeString'click'Trigger type for opening dropdown. Options: 'click', 'hover'
placementString'bottom-start'Dropdown placement relative to trigger
offsetArray[0, 0.125]Offset from trigger element [x, y]
closeOnOutsideClickBooleantrueClose dropdown when clicking outside
closeOnEscBooleantrueClose dropdown when pressing ESC key
buttonWidthString/Number'auto'Width applied to the trigger button
widthString/NumbernullExplicit dropdown width (matches trigger width when null)

Events

EventPayloadDescription
update:modelValuevalueEmitted when selection changes (for v-model)
item:selectitemEmitted when an item is selected
item:unselectitemEmitted when an item is unselected
menu:open-Emitted when dropdown menu opens
menu:close-Emitted when dropdown menu closes

Slots

SlotPropsDescription
trigger{ isOpen, selectedItems, toggleMenu, openMenu, closeMenu }Custom trigger element
triggerContent{ props }Replace only the inner content of the default trigger button
item{ item: Any, selected: Boolean, toggle: Function }Custom item rendering
no-data-Custom content when no items are available

Methods

MethodDescription
openMenu()Open the dropdown menu
closeMenu()Close the dropdown menu
toggleMenu()Toggle the dropdown menu open/closed

Basic Usage

vue
<template>
  <ODropdown
    v-model="selectedValue"
    :items="items"
    :multiple="true"
    @item:select="handleItemSelect"
  />
</template>

<script setup>
import { ref } from "vue";

const selectedValue = ref([]);
const items = ref([
  { text: "Option 1", value: "option1" },
  { text: "Option 2", value: "option2" },
  { text: "Option 3", value: "option3" },
]);

const handleItemSelect = (item) => {
  console.log("Selected:", item);
};
</script>