diff --git a/docs/components/content/examples/CommandPaletteExampleGroups.vue b/docs/components/content/examples/CommandPaletteExampleGroups.vue
index 3d8f3933..bfeab645 100644
--- a/docs/components/content/examples/CommandPaletteExampleGroups.vue
+++ b/docs/components/content/examples/CommandPaletteExampleGroups.vue
@@ -10,10 +10,10 @@ const users = [
]
const actions = [
- { id: 'new-file', label: 'Add new file', icon: 'i-heroicons-document-plus', click: () => alert('New file') },
- { id: 'new-folder', label: 'Add new folder', icon: 'i-heroicons-folder-plus', click: () => alert('New folder') },
- { id: 'hashtag', label: 'Add hashtag', icon: 'i-heroicons-hashtag', click: () => alert('Add hashtag') },
- { id: 'label', label: 'Add label', icon: 'i-heroicons-tag', click: () => alert('Add label') }
+ { id: 'new-file', label: 'Add new file', icon: 'i-heroicons-document-plus', click: () => alert('New file'), shortcuts: ['⌘', 'N'] },
+ { id: 'new-folder', label: 'Add new folder', icon: 'i-heroicons-folder-plus', click: () => alert('New folder'), shortcuts: ['⌘', 'F'] },
+ { id: 'hashtag', label: 'Add hashtag', icon: 'i-heroicons-hashtag', click: () => alert('Add hashtag'), shortcuts: ['⌘', 'H'] },
+ { id: 'label', label: 'Add label', icon: 'i-heroicons-tag', click: () => alert('Add label'), shortcuts: ['⌘', 'L'] }
]
const groups = computed(() => commandPaletteRef.value?.query
diff --git a/docs/components/content/examples/DropdownExample.vue b/docs/components/content/examples/DropdownExample.vue
index 5f4c2733..64af8fac 100644
--- a/docs/components/content/examples/DropdownExample.vue
+++ b/docs/components/content/examples/DropdownExample.vue
@@ -7,10 +7,12 @@ const items = [
}
}], [{
label: 'Edit',
- icon: 'i-heroicons-pencil-square-20-solid'
+ icon: 'i-heroicons-pencil-square-20-solid',
+ shortcuts: ['E']
}, {
label: 'Duplicate',
- icon: 'i-heroicons-document-duplicate-20-solid'
+ icon: 'i-heroicons-document-duplicate-20-solid',
+ shortcuts: ['D']
}], [{
label: 'Archive',
icon: 'i-heroicons-archive-box-20-solid'
@@ -19,7 +21,8 @@ const items = [
icon: 'i-heroicons-arrow-right-circle-20-solid'
}], [{
label: 'Delete',
- icon: 'i-heroicons-trash-20-solid'
+ icon: 'i-heroicons-trash-20-solid',
+ shortcuts: ['⌘', 'D']
}]
]
diff --git a/docs/components/content/examples/KbdExample.vue b/docs/components/content/examples/KbdExample.vue
new file mode 100644
index 00000000..c85eb57e
--- /dev/null
+++ b/docs/components/content/examples/KbdExample.vue
@@ -0,0 +1,10 @@
+
+
+
+
+ {{ metaSymbol }}
+ U
+
+
diff --git a/docs/components/content/examples/TooltipExample.vue b/docs/components/content/examples/TooltipExample.vue
index 5939612e..41914e42 100644
--- a/docs/components/content/examples/TooltipExample.vue
+++ b/docs/components/content/examples/TooltipExample.vue
@@ -1,5 +1,5 @@
-
-
+
+
diff --git a/docs/components/docs/DocsAside.vue b/docs/components/docs/DocsAside.vue
index 88163c9a..edcc7104 100644
--- a/docs/components/docs/DocsAside.vue
+++ b/docs/components/docs/DocsAside.vue
@@ -14,9 +14,9 @@
>
Search
-
-
-
+
+ {{ metaSymbol }}
+ K
@@ -30,4 +30,5 @@
diff --git a/docs/content/2.elements/4.dropdown.md b/docs/content/2.elements/4.dropdown.md
index d3af9102..eecda917 100644
--- a/docs/content/2.elements/4.dropdown.md
+++ b/docs/content/2.elements/4.dropdown.md
@@ -22,10 +22,12 @@ const items = [
}
}], [{
label: 'Edit',
- icon: 'i-heroicons-pencil-square-20-solid'
+ icon: 'i-heroicons-pencil-square-20-solid',
+ shortcuts: ['E']
}, {
label: 'Duplicate',
- icon: 'i-heroicons-document-duplicate-20-solid'
+ icon: 'i-heroicons-document-duplicate-20-solid',
+ shortcuts: ['D']
}], [{
label: 'Archive',
icon: 'i-heroicons-archive-box-20-solid'
@@ -34,7 +36,8 @@ const items = [
icon: 'i-heroicons-arrow-right-circle-20-solid'
}], [{
label: 'Delete',
- icon: 'i-heroicons-trash-20-solid'
+ icon: 'i-heroicons-trash-20-solid',
+ shortcuts: ['⌘', 'D']
}]
]
diff --git a/docs/content/2.elements/5.kbd.md b/docs/content/2.elements/5.kbd.md
new file mode 100644
index 00000000..ee4722a8
--- /dev/null
+++ b/docs/content/2.elements/5.kbd.md
@@ -0,0 +1,48 @@
+---
+github: true
+title: 'Keyboard Key'
+navigation:
+ title: 'Kbd'
+---
+
+## Usage
+
+::component-example
+#default
+:kbd-example
+
+#code
+```vue
+
+
+
+
+ {{ metaSymbol }}
+ U
+
+
+```
+::
+
+### Size
+
+Use the `size` prop to change the size of the Kbd.
+
+::component-card
+---
+props:
+ size: 'sm'
+---
+
+U
+::
+
+## Props
+
+:component-props
+
+## Preset
+
+:component-preset
diff --git a/docs/content/4.navigation/2.command-palette.md b/docs/content/4.navigation/2.command-palette.md
index 21178e14..59407ba2 100644
--- a/docs/content/4.navigation/2.command-palette.md
+++ b/docs/content/4.navigation/2.command-palette.md
@@ -118,10 +118,10 @@ const users = [
]
const actions = [
- { id: 'new-file', label: 'Add new file', icon: 'i-heroicons-document-plus', click: () => alert('New file') },
- { id: 'new-folder', label: 'Add new folder', icon: 'i-heroicons-folder-plus', click: () => alert('New folder') },
- { id: 'hashtag', label: 'Add hashtag', icon: 'i-heroicons-hashtag', click: () => alert('Add hashtag') },
- { id: 'label', label: 'Add label', icon: 'i-heroicons-tag', click: () => alert('Add label') }
+ { id: 'new-file', label: 'Add new file', icon: 'i-heroicons-document-plus', click: () => alert('New file'), shortcuts: ['⌘', 'N'] },
+ { id: 'new-folder', label: 'Add new folder', icon: 'i-heroicons-folder-plus', click: () => alert('New folder'), shortcuts: ['⌘', 'F'] },
+ { id: 'hashtag', label: 'Add hashtag', icon: 'i-heroicons-hashtag', click: () => alert('Add hashtag'), shortcuts: ['⌘', 'H'] },
+ { id: 'label', label: 'Add label', icon: 'i-heroicons-tag', click: () => alert('Add label'), shortcuts: ['⌘', 'L'] }
]
const groups = computed(() => commandPaletteRef.value?.query
diff --git a/docs/content/5.overlays/4.tooltip.md b/docs/content/5.overlays/4.tooltip.md
index db3f8e29..141af9f7 100644
--- a/docs/content/5.overlays/4.tooltip.md
+++ b/docs/content/5.overlays/4.tooltip.md
@@ -10,8 +10,8 @@ github: true
#code
```vue
-
-
+
+
```
diff --git a/src/runtime/app.config.ts b/src/runtime/app.config.ts
index cc2177f5..79209ccf 100644
--- a/src/runtime/app.config.ts
+++ b/src/runtime/app.config.ts
@@ -179,7 +179,7 @@ const dropdown = {
base: 'flex-shrink-0',
size: '3xs'
},
- shortcuts: 'hidden md:inline-flex flex-shrink-0 text-xs font-semibold text-gray-500 dark:text-gray-400 ml-auto'
+ shortcuts: 'hidden md:inline-flex flex-shrink-0 gap-0.5 ml-auto'
},
transition: {
enterActiveClass: 'transition duration-100 ease-out',
@@ -195,6 +195,23 @@ const dropdown = {
}
}
+const kbd = {
+ base: 'inline-flex items-center justify-center text-gray-900 dark:text-white',
+ spacing: 'px-1',
+ size: {
+ xs: 'h-4 min-w-[16px] text-[10px]',
+ sm: 'h-5 min-w-[20px] text-[11px]',
+ md: 'h-6 min-w-[24px] text-[12px]'
+ },
+ rounded: 'rounded',
+ font: 'font-medium font-sans',
+ background: 'bg-gray-100 dark:bg-gray-800',
+ ring: 'ring-1 ring-gray-300 dark:ring-gray-700 ring-inset',
+ default: {
+ size: 'sm'
+ }
+}
+
// Forms
const input = {
@@ -494,7 +511,7 @@ const commandPalette = {
selected: {
icon: 'h-4 w-4 text-gray-900 dark:text-white flex-shrink-0'
},
- shortcuts: 'hidden md:inline-flex flex-shrink-0 text-xs font-semibold text-gray-500 dark:text-gray-400'
+ shortcuts: 'hidden md:inline-flex flex-shrink-0 gap-0.5'
},
active: 'flex-shrink-0 text-gray-500 dark:text-gray-400',
inactive: 'flex-shrink-0 text-gray-500 dark:text-gray-400'
@@ -582,7 +599,7 @@ const tooltip = {
rounded: 'rounded',
ring: 'ring-1 ring-gray-200 dark:ring-gray-800',
base: 'invisible lg:visible h-6 px-2 py-1 text-xs font-normal truncate',
- shortcuts: 'hidden md:inline-flex items-center justify-end flex-shrink-0 gap-0.5 ml-1',
+ shortcuts: 'hidden md:inline-flex flex-shrink-0 gap-0.5',
transition: {
enterActiveClass: 'transition ease-out duration-200',
enterFromClass: 'opacity-0 translate-y-1',
@@ -688,6 +705,7 @@ export default {
button,
buttonGroup,
dropdown,
+ kbd,
input,
inputGroup,
textarea,
diff --git a/src/runtime/components/elements/Dropdown.vue b/src/runtime/components/elements/Dropdown.vue
index 2fc47b26..eab4cdfa 100644
--- a/src/runtime/components/elements/Dropdown.vue
+++ b/src/runtime/components/elements/Dropdown.vue
@@ -33,7 +33,7 @@
{{ item.label }}
- {{ shortcut }}
+ {{ shortcut }}
@@ -53,7 +53,8 @@ import { defineComponent, ref, computed, onMounted } from 'vue'
import { defu } from 'defu'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
-import { classNames, omit } from '../../utils'
+import UKbd from '../elements/Kbd.vue'
+import { omit } from '../../utils'
import { usePopper } from '../../composables/usePopper'
import type { Avatar as AvatarType } from '../../types/avatar'
import type { PopperOptions } from '../../types'
@@ -73,7 +74,8 @@ export default defineComponent({
MenuItems,
MenuItem,
UIcon,
- UAvatar
+ UAvatar,
+ UKbd
},
props: {
items: {
diff --git a/src/runtime/components/elements/Kbd.vue b/src/runtime/components/elements/Kbd.vue
new file mode 100644
index 00000000..21423f88
--- /dev/null
+++ b/src/runtime/components/elements/Kbd.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
diff --git a/src/runtime/components/navigation/CommandPaletteGroup.vue b/src/runtime/components/navigation/CommandPaletteGroup.vue
index 826328b5..a8b842cf 100644
--- a/src/runtime/components/navigation/CommandPaletteGroup.vue
+++ b/src/runtime/components/navigation/CommandPaletteGroup.vue
@@ -45,7 +45,7 @@
- {{ shortcut }}
+ {{ shortcut }}
{{ group.inactive }}
@@ -61,6 +61,7 @@ import type { PropType } from 'vue'
import { ComboboxOption } from '@headlessui/vue'
import UIcon from '../elements/Icon.vue'
import UAvatar from '../elements/Avatar.vue'
+import UKbd from '../elements/Kbd.vue'
import type { Group } from '../../types/command-palette'
// TODO: Remove
// @ts-expect-error
@@ -72,7 +73,8 @@ export default defineComponent({
components: {
ComboboxOption,
UIcon,
- UAvatar
+ UAvatar,
+ UKbd
},
props: {
group: {
diff --git a/src/runtime/components/overlays/Tooltip.vue b/src/runtime/components/overlays/Tooltip.vue
index 20612b1a..668c996b 100644
--- a/src/runtime/components/overlays/Tooltip.vue
+++ b/src/runtime/components/overlays/Tooltip.vue
@@ -12,10 +12,10 @@
- ·
-
+ ·
+
{{ shortcut }}
-
+
@@ -27,6 +27,7 @@
import { computed, ref, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { defu } from 'defu'
+import UKbd from '../elements/Kbd.vue'
import { usePopper } from '../../composables/usePopper'
import type { PopperOptions } from '../../types'
import { useAppConfig } from '#imports'
@@ -37,6 +38,9 @@ import appConfig from '#build/app.config'
// const appConfig = useAppConfig()
export default defineComponent({
+ components: {
+ UKbd
+ },
props: {
text: {
type: String,