Launch sale — 60% off Pro
Contact
kbdPlatform Specific

Not affiliated with official shadcn/ui. Visit ui.shadcn.com for official docs.

React kbd - Platform-Aware Shortcut

Platform-aware Kbd component using navigator.platform detection to show ⌘ on Mac or Ctrl on Windows for cross-platform keyboard shortcuts built with shadcn/ui

Looking to implement shadcn/ui patterns?

Join our Discord community for help from other developers.


Cross-platform apps need shortcuts that adapt to user's OS—showing ⌘ to Mac users, Ctrl to Windows users. This React pattern detects platform using navigator.platform with indexOf checking for MAC, conditionally rendering Command symbol or Ctrl text in KbdGroup. Built with shadcn/ui Kbd component and use client directive for browser API access, it's perfect for cross-platform web apps, documentation sites, developer tools, or any interface serving both Mac and Windows users where adaptive shortcuts create native experience without maintaining separate documentation versions.

CtrlK

Pattern created by @haydenbleasel

Installation

Questions you might have