SSE Hooks

useKbd

GitHub
Custom hook that detects the operating system (Mac vs. Windows/Linux) and provides a normalized map of keyboard keys (e.g., mapping "Meta" to "Command" on Mac and "Ctrl" on Windows).

Installation

npx sse-hooks add use-kbd

Usage

example.ts
import { useKbd } from "./{hooks file}";

const { isMac, getKbdKey } = useKbd();
// Returns "⌘" on Mac, "Ctrl" on Windows
const metaSymbol = getKbdKey("meta");
return <div>Press {metaSymbol} + C to copy</div>;

API

Parameters

Prop Default Type

Returns

Return Value Default Type

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

Built with Love • © 2026