Misc
Kbd
A key or a shortcut as it looks on the reader’s own keyboard: ⌘ on a Mac, Ctrl everywhere else, each symbol still named for a screen reader.
WAI-ARIA tested
Import
main.ts
import { Kbd } from '@vitral/vue';Shortcuts
`mod` is the platform's command key. The page asks the browser which platform it is on once it is mounted, so a server render and the first paint agree.
Open the command palette with CtrlK, save with CtrlS, and find anything with CtrlShiftF.
Platforms
`platform` pins the names, for documentation written about one platform.
macOSCommandOptionShiftPWindows and LinuxCtrlAltShiftP
Sizes and single keys
ShiftEnterShiftEnterShiftEnterEscGI
API
Read from packages/vue/src/components/Kbd/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| keys | string | string[] | The shortcut: `'mod+k'`, `'shift+enter'`, or the keys as an array. `mod` is ⌘ on a Mac and Ctrl elsewhere, and the modifiers are drawn as each platform draws them. The default slot replaces it for a single key. |
| separator | string | Drawn between the keys. Defaults to none on a Mac, where ⌘⇧P is read as one, and `'+'` elsewhere. |
| platform | 'auto' | 'mac' | 'other' | Which platform's names to use; `'auto'` (the default) asks the browser once mounted. |
| size | Size | — |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Slots
| Name | Slot props | Description |
|---|---|---|
| default | — | One key's text, in place of `keys`. |