Components
Kbd
Key cap for a keyboard key or shortcut that adapts its contrast inside buttons.
import { Kbd } from "@openperf/deft";
<Kbd.Root>K</Kbd.Root>;Kbd only displays the key: register the shortcut in your application. It adds no ARIA attributes, so pass aria-hidden to a hint that screen readers should skip.
Size
A key cap is 18px tall, at least 18px wide and grows with its content, so a single letter and a word such as "Esc" both fit. Use one cap per key, or put a whole combination in a single cap.
Composition
Inside a Button, the default, field and primary variants change the background of the cap so it stays visible. Menu items and Sidebar items take a cap in their trailing slot.
<Button.Root variant="primary">
Search
<Kbd.Root>⌘K</Kbd.Root>
</Button.Root>API
Kbd.Root declares no props of its own.