Skip to main content

Kbd

Kbd is a decorative element used to represent specific keyboard keys. It is typically embedded inside components (e.g., menu, table, button) or paragraph text, to communicate an associated keyboard shortcut or a user instruction.

Also known as: Key
Salt package@salt-ds/core
Available since1.58.0

Screen readers will announce Kbd content as plain text.

  • Always use Kbd alongside descriptive text that explains the associated action. For example: "Press Ctrl+K to open search" This ensures users understand the purpose of the keyboard shortcut.
  • For multi-key shortcuts, include clear text separators (such as “+”) between keys (e.g, "Ctrl + Shift + K"). Avoid combining keys without separators (e.g., "CtrlShiftK")
  • The Kbd component itself is not focusable. When Kbd is nested within interactive elements (such as buttons or inputs), the parent element is responsible for handling all keyboard interactions.