Kbd
Display one keyboard key as shortcut notation.
Anatomy#
Usage#
Use Kbd to display one key in a shortcut hint. Combine keys with KbdGroup. Showing a shortcut does not register a keyboard handler.
Key aliases#
Known aliases such as meta, command, shift, escape, and arrowup resolve case-insensitively to a symbol or short label (⌘, ⇧, Esc, ↑) and a spoken name from the locale messages. Any other value renders as written.
symbol={false}: renders an alias as written without its spoken name.translations: overrides the spoken alias names per instance.aria-label: sets a custom accessible name and takes precedence over the alias name.
Root styling#
Kbd renders a single <kbd> root. Use variant ('default', 'outline', or 'invert') and size ('sm', 'md', or 'lg') for built-in treatments.
Use class and style for an individual keycap, or configure kbd.base.root in your Theme for shared defaults. Because root is the only slot, classes and styles duplicate class and style.
Examples#
Basic#
Place keycaps in instructional copy. Registration of those shortcuts stays in application code.
API Reference#
Props#
Props for the Kbd component. Renders a <kbd> element by default.