forked from learningequality/kolibri-design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kdropdownmenu.vue
79 lines (65 loc) · 2.21 KB
/
kdropdownmenu.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
<DocsPageTemplate apiDocs>
<DocsPageSection title="Overview" anchor="#overview">
<p>
Implements a dropdown set of options, based on <DocsExternalLink text="Keen's UI Menu" href="https://josephuspaye.github.io/Keen-UI/#/ui-menu" />. See these docs to understand the current implementation of the options object array.
</p>
<p>
Notable possible for configuring the menu include: icons, text, secondary text, and dividers.
</p>
<p>
Please see the <DocsInternalLink href="/buttons#dropdowns" text="Dropdown section of the Buttons and links page" /> on the buttons page for more details about how to use with a button, and a code example.
</p>
<h3>Context menu</h3>
<p>
This component can be also used to create a context menu, which is a dropdown menu that appears when a user right-clicks on an element.
</p>
<DocsShow block>
<p>
For example, you can right click on this paragraph to see a context menu.
</p>
<KDropdownMenu
isContextMenu
:options="[
{ label: 'Option 1' },
{ label: 'Option 2' },
{ label: 'Option 3' },
]"
/>
</DocsShow>
<DocsShow block>
<p>
Note that just one context menu can be open at a time. If you right-click on this paragraph, any other context menu will close.
</p>
<KDropdownMenu
isContextMenu
:options="[
{ label: 'Option 1' },
{ label: 'Option 2' },
]"
/>
</DocsShow>
<p>
To achieve this, set the <code>isContextMenu</code> prop to true.
The context menu will then be attached to the parent element.
</p>
<DocsShowCode language="html">
<div>
<p> ... </p>
<KDropdownMenu
isContextMenu
:options="[
{ label: 'Option 1' },
{ label: 'Option 2' },
{ label: 'Option 3' },
]"
/>
</div>
</DocsShowCode>
</DocsPageSection>
</DocsPageTemplate>
</template>
<script>
export default {};
</script>
<style lang="scss" scoped></style>