mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-26 18:00:43 +01:00
chore(Kbd): usage with value prop
This commit is contained in:
@@ -5,6 +5,6 @@ const { metaSymbol } = useShortcuts()
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center gap-0.5">
|
<div class="flex items-center gap-0.5">
|
||||||
<UKbd>{{ metaSymbol }}</UKbd>
|
<UKbd>{{ metaSymbol }}</UKbd>
|
||||||
<UKbd>U</UKbd>
|
<UKbd>K</UKbd>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -7,6 +7,27 @@ navigation:
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
Use the default slot to set the text of the Kbd.
|
||||||
|
|
||||||
|
::component-card
|
||||||
|
---
|
||||||
|
code: K
|
||||||
|
---
|
||||||
|
|
||||||
|
K
|
||||||
|
::
|
||||||
|
|
||||||
|
You can also use the `value` prop:
|
||||||
|
|
||||||
|
::component-card
|
||||||
|
---
|
||||||
|
props:
|
||||||
|
value: K
|
||||||
|
---
|
||||||
|
::
|
||||||
|
|
||||||
|
As explained in the [Shortcuts](/getting-started/shortcuts) page, you can use the `metaSymbol` property of the `useShortcuts` composable to display the meta key according to the user's OS.
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
#default
|
#default
|
||||||
:kbd-example
|
:kbd-example
|
||||||
@@ -20,7 +41,7 @@ const { metaSymbol } = useShortcuts()
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center gap-0.5">
|
<div class="flex items-center gap-0.5">
|
||||||
<UKbd>{{ metaSymbol }}</UKbd>
|
<UKbd>{{ metaSymbol }}</UKbd>
|
||||||
<UKbd>U</UKbd>
|
<UKbd>K</UKbd>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<kbd :class="[ui.base, ui.size[size], ui.padding, ui.rounded, ui.font, ui.background, ui.ring]">
|
<kbd :class="[ui.base, ui.size[size], ui.padding, ui.rounded, ui.font, ui.background, ui.ring]">
|
||||||
<slot />
|
<slot>{{ value }}</slot>
|
||||||
</kbd>
|
</kbd>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -17,6 +17,10 @@ import appConfig from '#build/app.config'
|
|||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
value: {
|
||||||
|
type: String,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => appConfig.ui.kbd.default.size,
|
default: () => appConfig.ui.kbd.default.size,
|
||||||
|
|||||||
Reference in New Issue
Block a user