Skip to content

Kbd

  • Keyboard shortcuts in help text: “Press ⌘ K”
  • Shortcuts inside a Tooltip or a Menu item

Not for general code or values — use <code>.

Choosing between small labels:

ComponentUse it forFor example
BadgeThe status or category of something, at a glance“Paid”, “Overdue”, “Beta”
ChipTags, filters and metadata, often several in a row“React”, “Remote”, an applied filter
KbdA key on the keyboard, in text or a tooltipPress ⌘ K to search

Press ⌘ K to search, Esc to close, and Shift Tab to go back.

import { Kbd } from '@arun-dev/ui';
export default function KbdBasics() {
return (
<p style={{ margin: 0 }}>
Press <Kbd>⌘</Kbd> <Kbd>K</Kbd> to search, <Kbd>Esc</Kbd> to close, and <Kbd>Shift</Kbd>{' '}
<Kbd>Tab</Kbd> to go back.
</p>
);
}

Kbd is a styled <kbd>, for a key in running text. Write a combination as keys side by side. It sizes with the surrounding text.

Kbd props
PropTypeDefaultDescription
classNamestringConcatenated with the component's own classes, never replacing them.
renderReactElementElement or component to render instead of the default. Props, className, event handlers and ref are merged onto it.
refRef<HTMLElement>Ref to the rendered element. Merged with any ref on the render element.
…restHTMLAttributesAnything else is spread onto the rendered element, so id, aria-*, data-* and event handlers all reach the DOM.