Shortcut help
Show a key combination next to the command it invokes.
Components / Utilities
A native keyboard-input hint for shortcuts and commands.
Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.
bunx --bun @getweini/cli@latest add kbdImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
Search: Ctrl + K
<script setup lang="ts">
import Kbd from './components/ui/kbd/Kbd.vue'
</script>
<template>
<p>Search: <Kbd>Ctrl</Kbd> + <Kbd>K</Kbd></p>
</template>Use the #icon slot for a decorative icon beside a key label. Give icon-only hints an accessible name. Kbd displays shortcuts; bind the actual keyboard behavior in your application.
Show a key combination next to the command it invokes.
Explain which key dismisses an overlay or confirms a choice.
Show each key as a separate semantic keycap.
<script setup lang="ts">
import Kbd from './components/ui/kbd/Kbd.vue'
</script>
<template>
<p>Search: <Kbd>Ctrl</Kbd> + <Kbd>K</Kbd></p>
</template>Use the small size in a dense command menu.
<script setup lang="ts">
import Kbd from './components/ui/kbd/Kbd.vue'
</script>
<template>
<span>Close menu <Kbd size="sm">Esc</Kbd></span>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
sizeprop | "sm" | "md" | undefined | "md" | Choose the visual size. Medium is the usual default where available. |
defaultslot | (() => unknown) | undefined | Optional | Content shown inside Kbd. |
iconslot | (() => unknown) | undefined | Optional | Content for the icon area of Kbd. |
// packages/frameworks/vue/components/kbd/types.ts
// ------- TYPES -------
export interface KbdProps {
size?: 'sm' | 'md'
}