It appears as a modal for tablets and smartphones, more precisely when the screen is narrower than $dropdown-mobile-breakpoint
. However, dropdowns with "hover"
trigger won't change its behavior to avoid any malfunction with hover. "hover"
trigger works like "click"
trigger on touch devices where hover events do not make sense. "hover"
trigger precedes "click"
trigger.
Dropdown
Dropdowns are very versatile, can used as a quick menu or even like a select for discoverable content
# Content and position
Add the custom
prop to the item to add any type of content.
Add the :focusable="false"
prop to the dropdown-item
if you dont want it to be focusable.
# Links within
Add the has-link
prop to add a anchor tag / router-link, or disabled
to disable an item.
# Customizing with v-model
# Multiple
Add the multiple
prop to select one or more item.
selected: []
# Scrollable
Add the scrollable
prop to make the list scrollable.
When the scrollable
prop is set to true
, use the max-height
prop to define the max height of the list.
# API
Dropdown
Name | Description | Type | Values | Default |
---|---|---|---|---|
v-model | Binding value | Any | — | null |
triggers | Dropdown will be triggered by any events | Array | click ,hover ,contextmenu ,focus | ['click'] |
position | Optional, position of the dropdown relative to the trigger | String | is-top-right , is-top-left , is-bottom-left | Bottom right |
disabled | Disables dropdown | Boolean | — | false |
animation | Custom animation (transition name) | String | — | fade |
inline | Dropdown content (items) are shown inline, trigger is removed | Boolean | — | false |
mobile-modal | Dropdown content (items) are shown into a modal on mobile | Boolean | — | true |
expanded | Dropdown will be expanded (full-width) | Boolean | — | false |
aria-role | Role attribute to be passed to list container for better accessibility. Use menu only in situations where your dropdown is related to navigation menus. | String | list , menu , dialog | — |
multiple | Allows multiple selections | Boolean | — | false |
trap-focus | Trap focus inside the dropdown. | Boolean | — | true |
can-close | Can close dropdown by pressing escape or by clicking outside | Boolean, Array | escape , outside | true |
close-on-click | Close dropdown when content is clicked | Boolean | — | true |
append-to-body | Append dropdown content to body (prevents event bubbling) | Boolean | — | false |
scrollable | Dropdown content will be scrollable | Boolean | — | false |
max-height | Max height of dropdown content | String, Number | — | 200px |
trigger-tabindex | Set the tabindex attribute on the dropdown trigger div (-1 to prevent selection via tab key) | Number | - | 0 |
Item
Name | Description | Type | Values | Default |
---|---|---|---|---|
value | The value that will be returned on events and v-model | Any | — | null |
separator | Set the item to be a separator | Boolean | — | false |
disabled | Item is disabled | Boolean | — | false |
focusable | Item can be focused | Boolean | — | true |
custom | Item is not a clickable item | Boolean | — | false |
has-link | Use it if your item is an anchor tag or router-link | Boolean | — | false |
paddingless | Remove padding | Boolean | — | false |
aria-role | Role attribute to be passed to list item for better accessibility. Use menuitem only in situations where your dropdown is related to navigation menus. | String | listitem , menuitem | — |
# Variables
You can use these variables to customize this component.
Name | Description | Default |
---|---|---|
$dropdown-mobile-breakpoint | The dropdown will be displayed as a modal below this value. | $desktop |
$dropdown-background-color | Modal background color when the dropdown is shown as a modal. | rgba($scheme-invert, 0.86) |
$dropdown-disabled-opacity: | Defines dropdown disabled opacity. | 0.5 |
Bulma variables | Link |
This page is open source. Noticed a typo or something's unclear?