Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key Hold API Reference
Held Keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Format for Display API Reference

detectPlatform

Function: detectPlatform()

ts
function detectPlatform(): "mac" | "windows" | "linux";

Defined in: constants.ts:30

Detects the current platform based on browser navigator properties.

Used internally to resolve platform-adaptive modifiers like 'Mod' (Command on Mac, Control elsewhere) and for platform-specific hotkey formatting.

Returns

"mac" | "windows" | "linux"

The detected platform: 'mac', 'windows', or 'linux'

Remarks

Defaults to 'linux' in SSR environments where navigator is undefined

Example

ts
const platform = detectPlatform() // 'mac' | 'windows' | 'linux'
const modifier = resolveModifier('Mod', platform) // 'Meta' on Mac, 'Control' elsewhere