Kbd
A keyboard key.
Press ⌘ K to search, or Esc to close.
When to use
- Use when
- Showing a keyboard shortcut or key in text or menus.
- Avoid when
- The text is code; use a code element.
Installation
The source lands in src/components/ui/kbd.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Built on
- Packages
@stylexjs/stylex- Shelf items
foundations,utils- Figma
- Optional native Figma library. See Designers.
Verified
- Size
- 0.9 kB gzipped on its own, 2.6 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 1 story
- Behavior
- 1 interaction test in Storybook
- React Compiler
- Compiles with React Compiler
- React Doctor
- React Doctor finds nothing