Skip to content

Commit 6dfbe7e

Browse files
committed
docs(dropdownbutton): add KB
1 parent 0faa874 commit 6dfbe7e

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Add a divider between items in the DropDownButton
3+
description: An example of how to add a divider between each item in a DropDownButton
4+
type: how-to
5+
page_title: Add a divider for items in the DropDownButton - Kendo UI Vue Native DropDownButton
6+
slug: dropdownbutton-divider
7+
tags: divider, dropdownbutton, items
8+
res_type: kb
9+
category: knowledge-base
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product Version</td>
18+
<td>6.3.0</td>
19+
</tr>
20+
<tr>
21+
<td>Product</td>
22+
<td>Progress® Kendo UI for Vue Native</td>
23+
</tr>
24+
</tbody>
25+
</table>
26+
27+
## Description
28+
29+
How can I add a divider between my items in the DropDownButton?
30+
31+
## Solution
32+
33+
This can be achieved by creating a custom item with an `hr` element and passing it to the [`itemRender`]({% slug api_buttons_dropdownbutton %}#toc-itemRender) prop:
34+
35+
{% meta height: 420 %}
36+
{% embed_file dropdownbutton-divider/main.vue preview %}
37+
{% embed_file dropdownbutton-divider/main.js %}
38+
{% endmeta %}
39+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue';
2+
import App from './main.vue';
3+
4+
createApp(App).mount('#app');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<template>
2+
<div>
3+
<DropDownButton :items="items" :item-render="itemRender" text="Export">
4+
<template v-slot:itemRender="{ props }">
5+
<div>
6+
<hr v-if="props.itemIndex > 0" class="my-dropdown-divider" />
7+
8+
<div class="k-link k-menu-link">
9+
<SvgIcon :icon="props.item.svgIcon" />
10+
<em>{{ `action #${props.itemIndex}: ${props.item.text}` }}</em>
11+
</div>
12+
</div>
13+
</template>
14+
</DropDownButton>
15+
</div>
16+
</template>
17+
18+
<script>
19+
import { DropDownButton } from '@progress/kendo-vue-buttons';
20+
import { filePdfIcon, fileExcelIcon } from '@progress/kendo-svg-icons';
21+
import { SvgIcon } from '@progress/kendo-vue-common';
22+
23+
export default {
24+
name: 'ExportDropdown',
25+
components: {
26+
DropDownButton,
27+
SvgIcon,
28+
},
29+
data() {
30+
return {
31+
items: [
32+
{ text: 'To PDF', svgIcon: filePdfIcon },
33+
{ text: 'To Excel', svgIcon: fileExcelIcon },
34+
{ text: 'Other' },
35+
],
36+
itemRender: 'itemRender',
37+
};
38+
},
39+
};
40+
</script>
41+
42+
<style scoped>
43+
.my-dropdown-divider {
44+
margin: 4px 0;
45+
border: none;
46+
border-top: 1px solid #ddd;
47+
}
48+
</style>
49+

0 commit comments

Comments
 (0)