Kbd
Kbd shows a keyboard key, such as Esc or ⌘. Use it to document shortcuts. For a key combination, wrap several Kbd elements in KbdGroup.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
Single keys
Show single keys as caps that widen to fit longer labels.
Separated chord
Put a literal + between keys inside a KbdGroup.
With icon
Place an icon inside a key cap, sized to match the text.
This example also needs:
Props
Kbd
Kbd adds no props of its own; it accepts the props of the element or primitive it wraps.
KbdGroup
KbdGroup adds no props of its own; it accepts the props of the element or primitive it wraps.
Kbd shows a keyboard key, such as Esc or ⌘. Use it to document shortcuts. For a key combination, wrap several Kbd elements in KbdGroup.
Installation
Copy and paste the following code into your project.
components/kbd/Kbd.vue components/kbd/KbdGroup.vue components/kbd/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
Single keys
Show single keys as caps that widen to fit longer labels.
Separated chord
Put a literal + between keys inside a KbdGroup.
With icon
Place an icon inside a key cap, sized to match the text.
This example also needs:
Props
Kbd
Kbd adds no props of its own; it accepts the props of the element or primitive it wraps.
KbdGroup
KbdGroup adds no props of its own; it accepts the props of the element or primitive it wraps.