Kbd
Shows a key, or keys pressed together or in turn, beside the action they run, so a person can learn the shortcut.
Examples
Save the searchCtrlShiftS
Close the panel Esc
Nothing pressed yet.
Go to the watchlistGthenW
Press G, then W within a second.
Press / from anywhere on the page to jump here.
Usage
Use it when
- An action has a keyboard shortcut and its tooltip, or the field it reaches, can show it.
- A help panel lists the shortcuts of a tool.
Use something else when
- The key is code to copy, such as a command. Use CopyButton instead, beside the code.
- The hint names a button on screen. Use Button instead, with its text.
Rules
General
Content
Avoid
Limits
Install
npx shadcn@latest add https://kaanarici.com/r/cobalt/kbd.jsonimport { Kbd, KbdGroup } from "@/components/cobalt/ui/kbd"