Skip to content
HomeCobalt

Kbd

Shows a key, or keys pressed together or in turn, beside the action they run, so a person can learn the shortcut.

Examples

A key and a combination beside what they do, with the reader's own modifier; press either one to see it answer.

Save the searchCtrlShiftS

Close the panel Esc

Nothing pressed yet.

Keys pressed in turnKeys pressed one after another, with then between them; press G, then W.

Go to the watchlistGthenW

Press G, then W within a second.

In a fieldThe key that reaches a search field, in its description; press / to try it.

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.json
import { Kbd, KbdGroup } from "@/components/cobalt/ui/kbd"