Kbd is used to display keyboard shortcuts and key combinations. Perfect for documentation and help interfaces.
Basic Example
Keyboard keys with different sizes
await import('/components/data-display/kbd.js');
const { tags, $ } = Lightview;
const { div, span, Kbd } = tags;
const shortcuts = div({ style: 'display: flex; flex-direction: column; gap: 1rem' },
div({ style: 'display: flex; gap: 0.5rem; align-items: center' },
span({}, 'Save: '),
Kbd({}, '⌘'),
Kbd({}, 'S')
),
div({ style: 'display: flex; gap: 0.5rem; align-items: center' },
span({}, 'Undo: '),
Kbd({}, '⌘'),
Kbd({}, 'Z')
),
div({ style: 'display: flex; gap: 0.5rem; align-items: center' },
span({}, 'Copy: '),
Kbd({}, '⌘'),
Kbd({}, 'C')
)
);
$('#example').content(shortcuts);
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size |
string | - | 'xs' | 'sm' | 'md' | 'lg' |
Kbd Gallery
Live examples using <lv-kbd> custom elements.
Keyboard Shortcuts
Save:
⌘
S
Copy:
⌘
C
Paste:
⌘
V
Undo:
⌘
Z