Skip to content
ghostui

Kbd

Show an inert keyboard shortcut hint beside the action it describes.

Preview

⌘K

Usage

Kbd is a native, inert hint. The surrounding action owns the shortcut and its behavior.

Examples

Keys

Keep icon and text keys at the same height. A small corner radius preserves the keycap shape.

Esc

Surface context

On a secondary surface, give the keys a darker fill through the inherited --ui-kbd-background CSS property. The surrounding surface owns this choice.

Esc

Text

Place the hint beside the action name.

Search
⌘K

Groups

Group the modifier and key into one named shortcut hint.

⌘K

Long hints

Keep a longer key sequence readable in a narrow space.

ControlPage Down

Small keycaps

Use the compact size for short labels such as an emoji shortcode.

:smile:

Subtle keycaps

Use the borderless variant when a filled keycap needs less visual weight.

⌘K

API reference

Set --ui-kbd-background to a CSS color on Kbd or an ancestor to change its fill. It falls back to var(--secondary).

Accessibility

Use familiar key names and a title for an ambiguous glyph. Name a sequence with KbdGroup aria-label. The hint has no listener or tab stop; its action owns the shortcut.

Installation

Install