Dropdown
Dropdown
can be used with embedded Option
or OptionGroup
.
Demos
Size variants
Available size values for the ui
prop: large
/small
/tiny
/micro
.
<template>
<article>
<veui-dropdown
label="Action"
ui="large"
:options="operations"
@click="alert"
/>
<veui-dropdown
label="Action"
:options="operations"
@click="alert"
/>
<veui-dropdown
label="Action"
ui="small"
:options="operations"
@click="alert"
/>
<veui-dropdown
label="Action"
ui="tiny"
:options="operations"
@click="alert"
/>
<veui-dropdown
label="Action"
ui="micro"
:options="operations"
@click="alert"
/>
</article>
</template>
<script>
import { Dropdown } from 'veui'
import toast from 'veui/managers/toast'
export default {
components: {
'veui-dropdown': Dropdown
},
data () {
return {
operations: [
{
label: 'Edit',
value: 'edit'
},
{
label: 'Delete',
value: 'delete'
},
{
label: 'Save',
value: 'save'
},
{
label: 'Publish',
value: 'publish'
}
]
}
},
methods: {
alert (e) {
toast.info(e)
}
}
}
</script>
Using embedded OptionGroup
s & Option
s
Can be used with embedded OptionGroup
s & Option
s.
<template>
<veui-dropdown
label="Files"
@click="alert"
>
<veui-option-group>
<veui-option
value="new-file"
label="New File"
/>
<veui-option
value="new-window"
label="New Window"
/>
</veui-option-group>
<veui-option-group>
<veui-option
value="open"
label="Open…"
/>
<veui-option
value="open-workspace"
label="Open Workspace…"
/>
<veui-option-group
label="Open Recent"
position="popup"
>
<veui-option-group>
<veui-option
value="reopen"
label="Reopen Closed Editor"
/>
</veui-option-group>
<veui-option-group>
<veui-option
value="open:~/Dropdown.vue"
label="~/Dropdown.vue"
/>
<veui-option
value="open:~/Select.vue"
label="~/Select.vue"
/>
</veui-option-group>
</veui-option-group>
</veui-option-group>
</veui-dropdown>
</template>
<script>
import { Dropdown, OptionGroup, Option } from 'veui'
import toast from 'veui/managers/toast'
export default {
components: {
'veui-dropdown': Dropdown,
'veui-option-group': OptionGroup,
'veui-option': Option
},
methods: {
alert (e) {
toast.info(e)
}
}
}
</script>
API
Props
Name | Type | Default | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ui | string | - | Style variants.
| ||||||||||||||
options | Array<Object>= | [] | The list of options with the option type being
| ||||||||||||||
label | string | - | The descriptive label of the dropdown button. | ||||||||||||||
trigger | string | 'click' | When to trigger the dropdown to open. Available values are 'click' /'hover' . | ||||||||||||||
split | boolean | false | Whether to split the dropdown button into a command button and a toggle button for the dropdown layer. | ||||||||||||||
disabled | boolean | false | Whether the dropdown is disabled. | ||||||||||||||
overlay-class | string|Array|Object | - | See the overlay-class prop of Overlay . |
Slots
Name | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
default | The content of the options dropdown layer. Can be used to place Option s or OptionGroups s when the options prop is not specified. | |||||||||||||||
before | The content before the options in the dropdown layer. | |||||||||||||||
after | The content after the options in the dropdown layer. | |||||||||||||||
label | The content of the select button. Displays the
| |||||||||||||||
group-label | The label text of each option group (option with child
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the scope object via | |||||||||||||||
option-label | The label text of each option (option without child
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the scope object via | |||||||||||||||
option | The entire content area of each option (option without child
Additionally, custom properties in current option, apart from the listed ones, will also be passes into the scope object via |
Events
Name | Description |
---|---|
click | Triggered when an option is clicked. The callback parameter list is (value: *=) . value is the value property of the option being clicked. Also triggered when split is true and the command button is clicked, in this case there won't be a value argument. |
Icons
Name | Description |
---|---|
expand | Expand the dropdown layer. |
collapse | Collapse the dropdown layer. |