Component libraryKeyboard key
Components/Essentials

Keyboard key

Free

Readable key labels and accessible shortcut chords for menus, search and help.

npx shadcn@latest add https://tidalui.com/r/keyboard-key.json
Desktop viewport

Installation

Terminal
npx shadcn@latest add https://tidalui.com/r/keyboard-key.json

Import components/ui/tidal.css, components/ui/keyboard-key.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.

Usage

Complete example source · Dependency and asset manifest

Loading the complete example…

API & behavior

TidalKeyboardKey forwards native kbd data/title/style/class attributes/ref; content is string or number with sm/md sizes; role, tabIndex and contentEditable are owned. TidalKeyboardShortcut forwards native span attributes/ref, accepts stable unique-id key entries with visual label and required accessibleLabel, optional textual separator and size. The chord is exposed as one image-like labelled object; visual key labels and separators are hidden from assistive technology to avoid repeated glyph readings. Override aria-label for a localized full phrase. Keys wrap within narrow containers and remain noninteractive. Consumers own keyboard handling, shortcut availability, platform mapping and localization; this component never registers shortcuts.

Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.

Building with an agent?Give it the installation guide and component catalog.