Keyboard keys for showing shortcuts, like the keys of Apple's Magic Keyboard: white or black (tone), or flat in the color of the text around them. To make a key work, put a Shortcut in the button or link: it shows the key and clicks the button when it's pressed, but not while someone is typing.
Source: src/components/ui/kbd.tsx
White and black keys, alone or pressed together in a KbdGroup, and the flat variant.
import { Kbd, KbdGroup } from "@/components/ui/kbd";
export default function KbdKeys() {
return (
<>
<KbdGroup>
<Kbd>⌘</Kbd>
<Kbd>K</Kbd>
</KbdGroup>
<KbdGroup>
<Kbd tone="dark">⌘</Kbd>
<Kbd tone="dark">K</Kbd>
</KbdGroup>
<Kbd>B</Kbd>
<Kbd tone="dark">B</Kbd>
<Kbd variant="flat">B</Kbd>
</>
);
}BookCallButton shortcut="b" in the navbar shows a black key like this on devices with a keyboard: at the left edge, 6px in from the top, bottom and left, with a little more room after it. Light buttons take a white key.
import { ChevronRightIcon } from "@/components/icons/mage";
import { Button } from "@/components/ui/button";
import { Kbd } from "@/components/ui/kbd";
export default function KbdInButton() {
return (
<>
<Button className="py-1.25 pl-1.25">
<Kbd tone="dark" className="mr-2 aspect-square h-full">
B
</Kbd>
Book a call
<ChevronRightIcon />
</Button>
<Button variant="secondary" className="py-1.25 pl-1.25">
<Kbd className="mr-2 aspect-square h-full">P</Kbd>
See pricing
</Button>
</>
);
}