chore(Kbd): new component

This commit is contained in:
Benjamin Canac
2023-05-09 14:26:10 +02:00
parent b21c55f5c4
commit 4586eed90c
14 changed files with 167 additions and 32 deletions

View File

@@ -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']
}]
]
</script>

View File

@@ -0,0 +1,48 @@
---
github: true
title: 'Keyboard Key'
navigation:
title: 'Kbd'
---
## Usage
::component-example
#default
:kbd-example
#code
```vue
<script setup>
const { metaSymbol } = useShortcuts()
</script>
<template>
<div class="flex items-center gap-0.5">
<UKbd>{{ metaSymbol }}</UKbd>
<UKbd>U</UKbd>
</div>
</template>
```
::
### Size
Use the `size` prop to change the size of the Kbd.
::component-card
---
props:
size: 'sm'
---
U
::
## Props
:component-props
## Preset
:component-preset

View File

@@ -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

View File

@@ -10,8 +10,8 @@ github: true
#code
```vue
<template>
<UTooltip text="Tooltip">
<UButton color="gray" label="Button" />
<UTooltip text="Tooltip example" :shortcuts="['⌘', 'O']">
<UButton color="gray" label="Hover me" />
</UTooltip>
</template>
```