Kbd
Data displayA key the user presses, as a small key cap: a <kbd> element. One Kbd per key, side by side for a combination (<Kbd>Ctrl</Kbd><Kbd>K</Kbd>), or the whole combination in one (<Kbd>⌘K</Kbd>). It takes an icon (<Icon> or a Lucide icon) for keys like Enter.
import { Kbd } from '@limerdev/zest'; Use for
Keyboard shortcuts in help text, a tooltip or an empty state: "Press Ctrl K to search".
Don't
A shortcut beside a menu item: use the menu's
Shortcut. Code or a value the user types: use <code>.Examples
Shortcuts
One Kbd per key, side by side for a combination, or the combination in one.
Press Ctrl K to search.
Press ⌘K on a Mac.
Press Enter to send.
<script lang="ts">
import CornerDownLeft from '@lucide/svelte/icons/corner-down-left';
import { Kbd } from '@limerdev/zest';
</script>
<div class="flex flex-col gap-2 text-sm text-muted">
<p>Press <Kbd>Ctrl</Kbd> <Kbd>K</Kbd> to search.</p>
<p>Press <Kbd>⌘K</Kbd> on a Mac.</p>
<p>Press <Kbd><CornerDownLeft aria-hidden="true" /> Enter</Kbd> to send.</p>
</div> Props
Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that
renders your own element, with props to spread on it).
Kbd
No props of its own beyond the common ones.