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
Dropdown component
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 name | Description | Type | Values | Default |
---|---|---|---|---|
active | - | false | ||
animation | - | From config: dropdown: { | ||
ariaRole | - | From config: dropdown: { | ||
checkScroll | - | From config: dropdown: { | ||
closeable | - | From config: dropdown: { | ||
delay | - | |||
disabled | - | false | ||
expanded | - | false | ||
inline | - | false | ||
label | - | |||
maxHeight | - | From config: dropdown: { | ||
menuId | - | null | ||
menuTabindex | - | null | ||
menuTag | - | From config: dropdown: { | ||
mobileBreakpoint | - | From config: dropdown: { | ||
mobileModal | - | From config: dropdown: { | ||
v-model | - | |||
override | - | |||
position | - | From config: dropdown: { | ||
scrollable | - | false | ||
tabindex | - | 0 | ||
teleport | - | From config: dropdown: { | ||
trapFocus | - | From config: dropdown: { | ||
triggerTag | - | From config: dropdown: { | ||
triggers | - | From config: dropdown: { |
Events
Event name | Properties | Description |
---|---|---|
update:modelValue | value string | number | object | array - updated modelValue prop | modelValue prop two-way binding |
update:active | value boolean - updated active prop | active prop two-way binding |
change | value string | number | object | array - selected value | on change event - fired after update:modelValue |
close | method string - close method | on close event |
scroll-start | the list inside the dropdown reached the start | |
scroll-end | the list inside the dropdown reached it's end |
Slots
Name | Description | Bindings |
---|---|---|
trigger | Override the trigger element, default is label prop | active boolean - dropdown active state |
default | Place dropdown items here | active boolean - dropdown active statetoggle boolean - toggle active state function |
DropdownItem component
html
<o-dropdown-item></o-dropdown-item>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
ariaRole | Role 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. | string | listitem , menuitem , button | From config: dropdown: { |
clickable | Item is clickable and emit an event | boolean | - | true |
disabled | Item is disabled | boolean | - | false |
label | Item label, unnecessary when default slot is used | string | - | |
tabindex | Set the tabindex attribute on the dropdown item div (-1 to prevent selection via tab key) | number|string | - | 0 |
tag | Dropdown item tag name | DynamicComponent | - | From config: dropdown: { |
value | Item value (it will be used as v-model of wrapper component) - default is an uuid | string|number|object | - | Default function (see source code) |
Events
Event name | Properties | Description |
---|---|---|
click | value string | number | object - value prop dataevent event - Native Event | onclick event |
Slots
Name | Description | Bindings |
---|---|---|
default | Override the label, default is label prop |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$dropdown-disabled-opacity | var(--#{$prefix}base-disabled-opacity) |
$dropdown-item-active-background-color | var(--#{$prefix}primary) |
$dropdown-item-active-color | var(--#{$prefix}primary-invert) |
$dropdown-item-color | #000000 |
$dropdown-item-disabled-opacity | var( --#{$prefix}base-disabled-opacity) |
$dropdown-item-font-size | var(--#{$prefix}base-font-size) |
$dropdown-item-hover-background-color | #f5f5f5 |
$dropdown-item-hover-color | #000000 |
$dropdown-item-line-height | var(--#{$prefix}base-line-height) |
$dropdown-item-padding | 0.375rem 1rem |
$dropdown-item-font-weight | 400 |
$dropdown-menu-background | #ffffff |
$dropdown-menu-border-radius | var(--#{$prefix}base-border-radius) |
$dropdown-menu-box-shadow | 0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.02) |
$dropdown-menu-spacer | 0px |
$dropdown-menu-margin | 0 |
$dropdown-menu-padding | 0.5rem 0 0.5rem 0 |
$dropdown-menu-width | 12rem |
$dropdown-menu-zindex | 50 |
$dropdown-mobile-max-height | calc(100vh - 120px) |
$dropdown-mobile-max-width | 460px |
$dropdown-mobile-overlay-color | rgba(#000000, 0.86) |
$dropdown-mobile-overlay-zindex | 55 |
$dropdown-mobile-width | calc(100vw - 40px) |
$dropdown-mobile-zindex | 60 |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
SASS Variable | Default |
---|---|
$dropdown-mobile-breakpoint | vars.$desktop |
$dropdown-background-background-color | hsla( #{css.getVar("scheme-h")}, #{css.getVar("scheme-s")}, #{css.getVar("scheme-invert-l")}, 0.86) |
$dropdown-disabled-opacity | 0.5 |
$dropdown-gap | 0px |
$dropdown-z | 40 |
See ➜ 📄 Full scss file
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$dropdown-modal-menu-zindex | $zindex-modal |
$dropdown-modal-backdrop-zindex | $zindex-modal-backdrop |
See ➜ 📄 Full scss file