Skip to content

Dropdown

Dropdowns are very versatile, can used as a quick menu or even like a select for discoverable content

Examples

Base

Show code

Inline

Show code

Multiple

Show code

Scrollable

Show code

Position

Show code

Programmatically

Show code

Class props

'Classes applied to the element'

Dropdowns are very versatile, can used as a quick menu or even like a select for discoverable content

html
<o-dropdown></o-dropdown>

Props

Prop nameDescriptionTypeValuesDefault
active-false
animation-
From config:
dropdown: {
  animation: "fade"
}
ariaRole-
From config:
dropdown: {
  ariaRole: "list"
}
checkScroll-
From config:
dropdown: {
  checkScroll: false
}
closeable-
From config:
dropdown: {
  closeable: ["escape","outside","content"]
}
delay-
disabled-false
expanded-false
inline-false
label-
maxHeight-
From config:
dropdown: {
  maxHeight: 200
}
menuId-null
menuTabindex-null
menuTag-
From config:
dropdown: {
  menuTag: "div"
}
mobileBreakpoint-
From config:
dropdown: {
  mobileBreakpoint: undefined
}
mobileModal-
From config:
dropdown: {
  mobileModal: true
}
v-model-
override-
position-
From config:
dropdown: {
  position: "bottom-left"
}
scrollable-false
tabindex-0
teleport-
From config:
dropdown: {
  teleport: false
}
trapFocus-
From config:
dropdown: {
  trapFocus: true
}
triggerTag-
From config:
dropdown: {
  triggerTag: "div"
}
triggers-
From config:
dropdown: {
  triggers: ["click"]
}

Events

Event namePropertiesDescription
update:modelValuevalue string | number | object | array - updated modelValue propmodelValue prop two-way binding
update:activevalue boolean - updated active propactive prop two-way binding
changevalue string | number | object | array - selected valueon change event - fired after update:modelValue
closemethod string - close methodon close event
scroll-startthe list inside the dropdown reached the start
scroll-endthe list inside the dropdown reached it's end

Slots

NameDescriptionBindings
triggerOverride the trigger element, default is label propactive boolean - dropdown active state
defaultPlace dropdown items hereactive boolean - dropdown active state
toggle boolean - toggle active state function
html
<o-dropdown-item></o-dropdown-item>

Props

Prop nameDescriptionTypeValuesDefault
ariaRoleRole attribute to be passed to the list item for better accessibility.
Use menuitem only in situations where your dropdown is related to a navigation menu.
stringlistitem, menuitem, button
From config:
dropdown: {
  itemAriaRole: "listitem"
}
clickableItem is clickable and emit an eventboolean-true
disabledItem is disabledboolean-false
labelItem label, unnecessary when default slot is usedstring-
tabindexSet the tabindex attribute on the dropdown item div (-1 to prevent selection via tab key)number|string-0
tagDropdown item tag nameDynamicComponent-
From config:
dropdown: {
  itemTag: "div"
}
valueItem value (it will be used as v-model of wrapper component) - default is an uuidstring|number|object-Default function (see source code)

Events

Event namePropertiesDescription
clickvalue string | number | object - value prop data
event event - Native Event
onclick event

Slots

NameDescriptionBindings
defaultOverride the label, default is label prop

Sass variables

Current theme ➜ Oruga

SASS VariableDefault
$dropdown-disabled-opacityvar(--#{$prefix}base-disabled-opacity)
$dropdown-item-active-background-colorvar(--#{$prefix}primary)
$dropdown-item-active-colorvar(--#{$prefix}primary-invert)
$dropdown-item-color#000000
$dropdown-item-disabled-opacityvar( --#{$prefix}base-disabled-opacity)
$dropdown-item-font-sizevar(--#{$prefix}base-font-size)
$dropdown-item-hover-background-color#f5f5f5
$dropdown-item-hover-color#000000
$dropdown-item-line-heightvar(--#{$prefix}base-line-height)
$dropdown-item-padding0.375rem 1rem
$dropdown-item-font-weight400
$dropdown-menu-background#ffffff
$dropdown-menu-border-radiusvar(--#{$prefix}base-border-radius)
$dropdown-menu-box-shadow0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.02)
$dropdown-menu-spacer0px
$dropdown-menu-margin0
$dropdown-menu-padding0.5rem 0 0.5rem 0
$dropdown-menu-width12rem
$dropdown-menu-zindex50
$dropdown-mobile-max-heightcalc(100vh - 120px)
$dropdown-mobile-max-width460px
$dropdown-mobile-overlay-colorrgba(#000000, 0.86)
$dropdown-mobile-overlay-zindex55
$dropdown-mobile-widthcalc(100vw - 40px)
$dropdown-mobile-zindex60

See ➜ 📄 Full scss file

Current theme ➜ Bulma

SASS VariableDefault
$dropdown-mobile-breakpointvars.$desktop
$dropdown-background-background-colorhsla( #{css.getVar("scheme-h")}, #{css.getVar("scheme-s")}, #{css.getVar("scheme-invert-l")}, 0.86)
$dropdown-disabled-opacity0.5
$dropdown-gap0px
$dropdown-z40

See ➜ 📄 Full scss file

Current theme ➜ Bootstrap

SASS VariableDefault
$dropdown-modal-menu-zindex$zindex-modal
$dropdown-modal-backdrop-zindex$zindex-modal-backdrop

See ➜ 📄 Full scss file

Released under the MIT License.